Collapsible
Show or hide a single section of content.
Installation
pnpm dlx shadcn@4.18.0 add @siteplane/collapsibleComplete the one-time setup first. Registry JSON lists source files and dependencies.
For this page’s examples, also install:
pnpm dlx shadcn@4.18.0 add @siteplane/button @siteplane/code @siteplane/frame @siteplane/separatorUsage
import {
Collapsible,
CollapsibleTrigger,
CollapsiblePanel,
} from "@/siteplane/components/collapsible";
<Collapsible>
<CollapsibleTrigger>Details</CollapsibleTrigger>
<CollapsiblePanel>Content</CollapsiblePanel>
</Collapsible>;Composition
Collapsible
├── CollapsibleTrigger
└── CollapsiblePanel / CollapsibleContentControlled state
Use open and onOpenChange when your application owns the open state. This trigger is an icon button, so it needs an accessible label.
File tree
Nest collapsibles to reveal folders level by level. Pass render to use a smaller ghost button as the trigger. A ChevronRightIcon with data-slot="collapsible-chevron" and data-turn="quarter" points to the row's end and turns down while the folder is open; file rows keep the chevron's column empty, so names line up.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
open / default | boolean | false | Controlled or initial visibility. |
on | (open, eventDetails) => void | unset | Visibility callback. |
disabled | boolean | false | Disables toggling. |
Collapsible | ReactElement | render function | text Button, full width | Composed trigger. |
Collapsible | boolean | false | Keeps a closed panel in the DOM, hidden. |
Collapsible, CollapsibleTrigger and CollapsiblePanel wrap Base UI
Collapsible with no
additional owned props. CollapsibleContent aliases Panel and
CollapsiblePrimitive exports the namespace. Root passes props directly; styled
Trigger/Panel accept string className. The panel animates its measured height.
CollapsibleTrigger doesn't add an indicator. Place a ChevronDownIcon with
data-slot="collapsible-chevron" inside the trigger: Siteplane UI rotates it while
the panel is open and skips the animation when reduced motion is requested. A
ChevronRightIcon with the same slot and data-turn="quarter" makes a quarter
turn instead, as in a tree.
Usage notes
Enter or Space activates the trigger. Keep its name meaningful in either state. Collapsible supplies disclosure behavior, not navigation or data loading.