
Expandable/collapsible content section with CSS transitions.
npx shadcn@latest add https://ui.edbn.me/r/collapsible.jsonGroups all parts of the collapsible. Renders a div element.
defaultOpenbooleanfalseInitial open state
openbooleanControlled open state
onOpenChangefunctionCalled when state changes
disabledbooleanfalseDisable collapsible
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
A button that opens and closes the collapsible panel. Renders a button element.
nativeButtonbooleantrueRender as native button
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-panel-open | Present when panel is open |
A panel with the collapsible contents. Renders a div element.
hiddenUntilFoundbooleanfalseUse content-visibility
keepMountedbooleanfalseKeep in DOM when closed
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when panel is open |
| data-closed | Present when panel is closed |
| data-starting-style | Present when animating in |
| data-ending-style | Present when animating out |
| Variable | Description |
|---|---|
| --collapsible-panel-height | The collapsible panel's height |
| --collapsible-panel-width | The collapsible panel's width |