Collapsible
A component that allows content to be expanded or collapsed with a smooth animation. Provides a space-efficient way to hide and reveal content, with support for both controlled and uncontrolled modes.
Can be controlled or uncontrolled
Full keyboard navigation
Architecture
Reference
Collapsible
The root container that manages the state and behavior of the collapsible system. Coordinates the interaction between trigger and content components.
Attributes
- default-openboolean/default: false
The initial open state of the collapsible when rendered. Use when you do not need to control its open state.
- disabledboolean/default: false
When
true, prevents the user from interacting with the collapsible. - openboolean/default: -
The controlled open state of the collapsible. Must be used in conjunction with
onOpenChange.
Content
The container that holds the collapsible content. Content within this component will be shown or hidden based on the collapsible's state.
Keyboard
- Space
Toggles the collapsible between open and closed states.
- Enter
Toggles the collapsible between open and closed states.