Collapsible
Single open/close disclosure with an animated content area.
2.8 kBgzipped
At a glance
- Single-item disclosure — for multi-item FAQ lists use
Accordion. - Compound API:
Collapsible.Trigger+Collapsible.Content. - Trigger wires
aria-expandedandaria-controlsautomatically. - Web:
Contentanimates via CSSmax-heighttransition (200 ms). - Native:
Contentmounts/unmounts immediately (animated height is a v2 follow-up).
Preview
Usage
Props
Collapsible
Accepts open (controlled) and onOpenChange for parent-driven state.
Use defaultOpen={true} for uncontrolled mode starting in the open position.
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | — |
defaultOpen | boolean | false | Uncontrolled initial open state. @defaultValue false |
onOpenChange | (open: boolean) => void | — | Fires when the open state changes. |
open | boolean | — | Controlled open state. |
testID | string | — | — |
Collapsible.Trigger
The button that toggles the panel. Accepts children (the visible label/icon)
and an optional asChild to render a custom element instead of the default
Pressable. Wires aria-expanded and aria-controls onto the trigger element
automatically.
Collapsible.Content
The panel that expands and collapses. Accepts children (the revealed content)
and an optional className for layout styles. On web the panel animates via a
CSS max-height transition (200 ms). On native, the panel mounts/unmounts
without animation in v1 — animated height is a v2 follow-up.