Accordion
Expandable content sections for organizing related information with terminal-style indicators.
Import
Usage
The Accordion component provides expandable content sections with terminal-aesthetic indicators.
Props
Accordion
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string[] | - | Selected value(s) for controlled mode |
| defaultValue | string[] | - | Default open item value(s) for uncontrolled mode |
| onValueChange | (value: string[]) => void | - | Callback when open items change |
| type | 'single' | 'multiple' | 'multiple' | Whether multiple items can be open at once |
| disabled | boolean | false | Whether the accordion is disabled |
| children | React.ReactNode | - | Accordion items |
| className | string | - | Additional CSS class names |
AccordionItem
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | - | Unique value identifying this item (required) |
| disabled | boolean | - | Whether this item is disabled |
| children | React.ReactNode | - | Item content (AccordionTrigger and AccordionContent) |
| className | string | - | Additional CSS class names |
AccordionTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
| children | React.ReactNode | - | Trigger content |
| className | string | - | Additional CSS class names |
AccordionContent
| Prop | Type | Default | Description |
|---|---|---|---|
| children | React.ReactNode | - | Panel content |
| className | string | - | Additional CSS class names |
Variants
Default Open
Use the defaultValue prop with an array of item values to control which accordion items are expanded when the component first renders.
Single Expansion Mode
Only one item can be open at a time:
In single mode, only one section can be open at a time. Opening another section will automatically close this one.
Controlled Mode
Manage the open state externally: