tsimport {XDSCollapsible} from '@xds/core/Collapsible'
| Guidance | Practices |
|---|---|
| Do | Wrap each XDSCollapsible in an XDSCard for visual separation in accordion layouts. |
| Do | Use XDSCollapsibleGroup with type="single" for settings or FAQ pages where only one section should be open at a time. |
| Do | Use type="multiple" when users need to compare content across sections, like feature lists or pricing tiers. |
| Do | Start sections open (defaultIsOpen) when the content is likely needed on first view — don't make users click to see essential info. |
| Don't | Hide critical or required content behind a collapsible — users may not discover it. |
| Don't | Nest collapsibles more than two levels deep — it makes content hard to find and navigate. |
| Don't | Use a collapsible for a single short paragraph — just show the text directly instead. |
| Prop | Type | Description |
|---|---|---|
triggerrequired | ReactNode | Content shown in the trigger area (always visible). |
children | ReactNode | Content that collapses and expands. |
defaultIsOpen | boolean (default: true) | Default open state (uncontrolled). |
isOpen | boolean | Controlled open state. |
onOpenChange | (isOpen: boolean) => void | Callback invoked when the open state changes. |
value | string | Identifier used for group coordination. Required when placed inside an XDSCollapsibleGroup. |
| Prop | Type | Description |
|---|---|---|
childrenrequired | ReactNode | XDSCollapsible instances to coordinate. |
type | 'single' | 'multiple' (default: 'single') | Whether one or many items can be open simultaneously. |
defaultValue | string | string[] | Default open item(s) for uncontrolled usage. Use a string for single mode and an array for multiple mode. |
value | string | string[] | Controlled open item(s). |
onChange | (value: string | string[]) => void | Callback invoked when the set of open items changes. |