Accordion API
View componentThe full prop reference for the Accordion component. A vertically stacked set of interactive headings that each reveal a section of content.
Import
import { Accordion } from '@structyl/styled';Props
Accordion.Root
Root accordion container; supports single or multiple open items
| Prop | Type | Default |
|---|---|---|
| type# | 'single' | 'multiple'Controls whether one or multiple items can be open at once | — |
| value# | string | string[] (depends on type)Controlled value; for 'single' type is string, for 'multiple' is string[] | — |
| defaultValue# | string | string[] (depends on type)Initial uncontrolled value; for 'single' is string, for 'multiple' is string[] | — |
| onValueChange# | (value: string | string[]) => voidFires when value changes; callback signature depends on type prop | — |
| collapsible# | booleanFor 'single' type only; if true, allows the open item to be collapsed | false |
| disabled# | booleanDisables all accordion items | — |
| orientation# | 'vertical' | 'horizontal'Keyboard navigation and layout direction | 'vertical' |
| dir# | 'ltr' | 'rtl'Text direction for RTL support | — |
| asChild# | booleanRender as child element (Radix asChild pattern) | — |
| variant# | 'default' | 'bordered' | 'separated' | 'flushed' | 'ghost'Visual variant (styled layer only) | 'default' |
| className# | stringCSS class name | — |
Accordion.Item
Individual accordion item wrapper
| Prop | Type | Default |
|---|---|---|
| value# | stringUnique identifier for the item; used to match Root.value | — |
| disabled# | booleanDisables this specific item (can override Root.disabled) | — |
| asChild# | booleanRender as child element (Radix asChild pattern) | — |
| className# | stringCSS class name | — |
Accordion.Header
Semantic heading element wrapping the trigger; renders as h3
| Prop | Type | Default |
|---|---|---|
| asChild# | booleanRender as child element (Radix asChild pattern) | — |
| className# | stringCSS class name | — |
Accordion.Trigger
Clickable button to toggle item open/closed; includes chevron icon
| Prop | Type | Default |
|---|---|---|
| icon# | React.ReactNodeCustom icon element; replaces default ChevronDown if provided | — |
| iconPosition# | 'left' | 'right'Position of the icon relative to trigger text (styled layer only) | 'right' |
| asChild# | booleanRender as child element (Radix asChild pattern) | — |
| className# | stringCSS class name | — |
Accordion.Content
Collapsible content region for accordion item
| Prop | Type | Default |
|---|---|---|
| forceMount# | booleanKeep DOM mounted even when closed (for animation control) | — |
| asChild# | booleanRender as child element (Radix asChild pattern) | — |
| className# | stringCSS class name | — |
Keyboard interactions
Adheres to the WAI-ARIA design pattern .
| Key | Description |
|---|---|
| Space / Enter | Expands / collapses the focused panel. |
| ArrowDown / ArrowUp | Moves focus between headers. |
| Home / End | Moves focus to the first / last header. |
Source code
If you didn't find what you need here, read the component implementation .