elementsaccordion
Accordion
Stacked disclosure component with single or multiple expanded sections.
Import#
Slot Structure#
Stacked item list where each item has a clickable header and collapsible content.
Examples#
Single#
Single-open mode with controlled state and icon leading/trailing slots.
Multiple#
Multiple-open mode with custom trailing icons.
Disabled + Custom Content#
Mix disabled items with rich JSX content blocks.
API Reference#
Attributes#
Slot
root1 attributeContainer that owns the accordion item collection and shared state attributes.
Data Attributes
| Data Attribute | Description |
|---|---|
| data-disabled | Present when the component or item is disabled. |
Props#
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | — | Class applied to the component root or trigger element. |
| classes | AccordionT.Classes | undefined | — | — |
| collapsible | boolean | undefined | true | Whether the last expanded item can be collapsed. |
| defaultValue | string[] | undefined | [] | Default list of expanded item values for uncontrolled usage. |
| disabled | boolean | undefined | false | Whether the entire accordion is disabled. |
| id | string | undefined | — | Unique identifier for the accordion root element. |
| items | AccordionT.Item[] | undefined | — | Array of accordion items to render. |
| loopFocus | boolean | undefined | true | Whether arrow-key focus wraps from the last trigger to the first and vice versa. |
| multiple | boolean | undefined | false | Whether multiple accordion items can be expanded at the same time. |
| onChange | ((value: string[]) => void) | undefined | — | Callback when the expanded item values change. |
| ref | JSX.HTMLElementTags["div"] extends { ref?: infer Ref; } ? Ref : never | undefined | — | — |
| style | JSX.CSSProperties | undefined | — | — |
| styles | AccordionT.Styles | undefined | — | — |
| trailing | IconT.Name | icon-chevron-down | Trailing icon name for all accordion items. |
| unmountOnHide | boolean | undefined | true | Whether to unmount accordion content when hidden. |
| value | string[] | undefined | — | Controlled list of expanded item values. |
Items#
| Prop | Type | Default | Description |
|---|---|---|---|
| content | JSX.Element | — | Content to display when the accordion item is expanded. |
| disabled | boolean | undefined | false | Whether the accordion item is disabled. |
| label | JSX.Element | — | Header label for the accordion item. |
| leading | IconT.Name | — | Leading icon name for the accordion item. |
| value | string | undefined | — | Unique value for the accordion item. |