tsimport {useCollapsible} from '@astryxdesign/core/Collapsible'
| Guidance | Practices |
|---|---|
| Do | Use the hook directly when building custom collapsible components that need XDS collapsible behavior without Collapsible wrapper. |
| Do | For accordion behavior, wrap items in CollapsibleGroup and pass unique value props. |
| Don't | Implement your own open/close state when useCollapsible already provides it; the hook handles group coordination automatically. |
| Param | Type | Description |
|---|---|---|
isCollapsible | boolean | CollapsibleConfig | Enable collapsible behavior. true = self-managed (starts open). Pass config object for controlled mode or custom defaults. |
value | string | Unique identifier within an CollapsibleGroup. When present and inside a group, state is managed by the group. |
| Field | Type | Description |
|---|---|---|
| isEnabled | boolean | Whether collapsible behavior is active. |
| isOpen | boolean | Whether the content is currently expanded. |
| toggle | () => void | Toggle open/closed state. Dispatches to group, controlled callback, or internal state. |