Collapsible
stableAn interactive component that expands / collapses a panel.
Basic usage
Examples
Controlled
Fully controlled open state with a dynamic toggle indicator.
Added keyboard support, reduced motion handling, and token-based styling.
Release notes disclosure
Use Collapsible for compact optional content with controlled or uncontrolled state.
Added searchable selects, multi-select values, and expanded component examples.
Features
- Smooth height animation.
- Controlled or uncontrolled.
Installation
bash
pnpm dlx structyl add collapsibleAPI Reference
Collapsible.Root
A single show/hide section.
| Prop | Type | Default |
|---|---|---|
| open | booleanControlled open state. | — |
| defaultOpen | booleanInitial open state. | — |
| onOpenChange | (open: boolean) => voidCalled when open state changes. | — |
| disabled | booleanDisable the collapsible. | false |
Collapsible.Trigger
Toggles the content.
| Prop | Type | Default |
|---|---|---|
| asChild | booleanMerge props onto the immediate child instead of rendering a default element. | false |
Collapsible.Content
The collapsible region.
| Prop | Type | Default |
|---|---|---|
| forceMount | booleanForce mounting for animation control. | — |