Collapsible
A single show/hide disclosure (Base UI behavior, animated height). The primitive behind Accordion; use it when you have just one region to reveal.
Real use · single show/hide region
Using Collapsible
Silica ships one design system through three paths. They share a class vocabulary but are not interchangeable — pick the one that matches what you are building.
Plain HTML — CSS classes
The Tailwind v4 plugin. Works in any framework or none — Rails, Django, PHP, Go, a static file. This path ships no JavaScript, so Collapsible is styled but inert: its behavior comes from disclosure. For that behavior with no framework, use the node-tree path below.
/* in your CSS */
@import "tailwindcss";
@plugin "@wizeworks/silicaui";Root class collapsible, with 4 modifiers:
.collapsible.collapsible-content.collapsible-panel.collapsible-trigger.collapsible-trigger-icon
React
Typed components over those same classes, with behavior and accessibility from Base UI.
npm i @wizeworks/silicaui-reactimport { Collapsible } from "@wizeworks/silicaui-react";Props
CollapsibleTriggerProps
| Prop | Type | Required | Description |
|---|---|---|---|
| chevron | boolean | no | Set false to omit the built-in chevron. Ignored when variant="icon". |
| variant | "default" | "icon" | no | "default" (the usual case) renders a full-width label + chevron row. |
CollapsiblePanelProps
| Prop | Type | Required | Description |
|---|---|---|---|
| children | React.ReactNode | no | — |
Source of the demo above
The exact file that renders the examples above, so it can never drift from them. It imports a few of this site’s own layout helpers (../lib/…), so read it for the component calls rather than copying it whole.
Show source
import { Collapsible, CollapsibleTrigger, CollapsiblePanel } from "@wizeworks/silicaui-react";
import { Section } from "../lib/Section";
export function CollapsibleDemo() {
return (
<Section title="Real use · single show/hide region">
<Collapsible defaultOpen className="max-w-md">
<CollapsibleTrigger>Shipping details</CollapsibleTrigger>
<CollapsiblePanel>
Ships in 2–3 business days via standard shipping. Express options
are available at checkout.
</CollapsiblePanel>
</Collapsible>
</Section>
);
}Vanilla — node tree to HTML
Collapsible — a single disclosure trigger/panel pair (not single-open — there's only one pair under this root). Build a node tree, project it with toHtml(), and let the zero-dependency runtime hydrate it. This is the path for generated or user-authored documents — a site builder, CMS output, a static export.
npm i @wizeworks/silicaui-html @wizeworks/silicaui-behaviorsimport { atom, toHtml } from "@wizeworks/silicaui-html";
const node = atom("Collapsible", "collapsible", { /* props */ }, [/* children */]);
const markup = toHtml(node);Styling on this path is the class string in the second argument — the same classes as the Plain HTML section above. There is no color prop here; write "collapsible collapsible-primary" rather than passing a colour as a prop.
- Takes children
- yes
- Hydrated by
disclosure
Load @wizeworks/silicaui-behaviors on the page or this markup renders correctly and does nothing.
The full API for Collapsible, on every path, is available through the Silica MCP server.