Collapsible
An interactive component which expands/collapses a panel.
@huin-core starred 3 repositories
@huin-core/primitives
Installation
npm i @huin-core/react-collapsibleAPI Reference
Collapsible
| Prop | Type | Description |
|---|---|---|
| asChild | boolean | When set to true, renders the component as its child element, inheriting the child's styles and behavior. |
| defaultOpen | boolean | Determines whether the component should be open by default when it is initially rendered. |
| open | boolean | Controls the open state of the component. When set to true, the component is displayed; when false, it is hidden. |
| onOpenChange | function | Event handler called when the open state of the component changes. |
| disabled | boolean | When set to true, disables the component, preventing user interaction or triggering of associated actions. |
CollapsibleTrigger
| Prop | Type | Description |
|---|---|---|
| disabled | boolean | When set to true, disables the component, preventing user interaction or triggering of associated actions. |
| asChild | boolean | When set to true, renders the component as its child element, inheriting the child's styles and behavior. |
CollapsibleContent
| Prop | Type | Description |
|---|---|---|
| disabled | boolean | When set to true, disables the component, preventing user interaction or triggering of associated actions. |
| forceMount | boolean | Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. It inherits from. |
Keyboard Interactions
| Key | Description |
|---|---|
Space Enter | Opens or closes the content. |