Collapsible
A collapsible panel controlled by a button.
API reference
Import the component and assemble its parts:
import { Collapsible } from '@base-ui-components/react/collapsible';
<Collapsible.Root> <Collapsible.Trigger /> <Collapsible.Panel /></Collapsible.Root>
Root
Groups all parts of the collapsible.
Renders a <div>
element.
Prop | Type | Default | |
---|---|---|---|
defaultOpen |
|
| |
open |
|
| |
onOpenChange |
|
| |
disabled |
|
| |
className |
|
|
Trigger
A button that opens and closes the collapsible panel.
Renders a <button>
element.
Prop | Type | Default | |
---|---|---|---|
className |
|
| |
render |
|
|
Attribute | Description | |
---|---|---|
data-panel-open | Present when the collapsible panel is open. |
Panel
A panel with the collapsible contents.
Renders a <div>
element.
Prop | Type | Default | |
---|---|---|---|
hiddenUntilFound |
|
| |
className |
|
| |
keepMounted |
|
| |
render |
|
|
Attribute | Description | |
---|---|---|
data-open | Present when the collapsible panel is open. | |
data-closed | Present when the collapsible panel is closed. | |
data-starting-style | Present when the panel is animating in. | |
data-ending-style | Present when the panel is animating out. |
CSS Variable | Description | |
---|---|---|
--collapsible-panel-height | The collapsible panel's height. | |
--collapsible-panel-width | The collapsible panel's width. |