elementscollapsible
Collapsible
Expandable content section with optional height transitions.
Import#
Slot Structure#
Single expandable section with a trigger slot.
Examples#
Uncontrolled and Transition#
FAQ pattern with optional height transition. Spacing belongs inside the content so the wrapper can collapse without layout shifts.
Controlled and Disabled#
External state controls a billing panel and can temporarily disable the trigger while an operation is locked.
Stateful Trigger#
Compose a compact row where only the icon button toggles detail content.
API Reference#
Attributes#
Slot
root0 attributesContainer that owns the trigger and expandable content state.
No attribute metadata for this slot.
Props#
| Prop | Type | Default | Description |
|---|---|---|---|
| children | JSX.Element | — | Content to render inside the collapsible. |
| class | ClassValue | — | Class applied to the component root or trigger element. |
| classes | CollapsibleT.Classes | undefined | — | — |
| defaultOpen | boolean | undefined | false | Whether the collapsible is open by default (uncontrolled). |
| disabled | boolean | undefined | false | Whether the collapsible is disabled. |
| id | string | undefined | — | Unique identifier for the collapsible root element. |
| onOpenChange | ((open: boolean) => void) | undefined | — | Callback when the open state changes. |
| open | boolean | undefined | — | Whether the collapsible is open (controlled). |
| ref | JSX.HTMLElementTags["div"] extends { ref?: infer Ref; } ? Ref : never | undefined | — | — |
| style | JSX.CSSProperties | undefined | — | — |
| styles | CollapsibleT.Styles | undefined | — | — |
| transition | boolean | undefined | false | Whether to keep content mounted until its height transition completes. |
| triggerRender* | ComponentOrElement<CollapsibleT.TriggerRenderProps> | — | Custom trigger renderer. Spread `triggerProps` onto the interactive trigger element. |