Accordions are a common UX pattern that can help reduce the amount of information presented to users. They are used to toggle the visibility of content, condensing information and reducing clutter.
Import all parts of the component and piece them together
The root component for the Accordion.
| Prop | Type | Default |
|---|---|---|
className | string | -- |
asChild | boolean | false |
loop | boolean | true |
orientation | enum | vertical |
disableTabIndexing | boolean | false |
disabled | boolean | false |
transitionDuration | number | 0 |
transitionTimingFunction | string | linear |
openMultiple | boolean | false |
type | enum | single |
collapsible | boolean | false |
value | (string | number)[] | -- |
defaultValue | (string | number)[] | [] |
onValueChange | function | -- |
The item component for the Accordion.
| Prop | Type | Default |
|---|---|---|
className | string | -- |
asChild | boolean | false |
disabled | boolean | false |
value* | string | number | -- |
Wraps an Accordion.Trigger in the appropriate heading semantics.
| Prop | Type | Default |
|---|---|---|
className | string | '' |
asChild | boolean | false |
The trigger component for the Accordion. This component is used to toggle the visibility of the AccordionItem.
| Prop | Type | Default |
|---|---|---|
className | string | -- |
asChild | boolean | false |
id | string | -- |
Contains the collapsible panel for an Accordion item.
| Prop | Type | Default |
|---|---|---|
className | string | '' |
forceMount | boolean | false |
asChild | boolean | false |
| Shortcut | Description |
|---|---|
| Space | When focus is on an Accordion.Trigger of a collapsed section, expands the section. |
| Enter | When focus is on an Accordion.Trigger of an expanded section, collapses the section. |
| Tab | When focus is on an Accordion.Trigger of a collapsed section, focuses the next Accordion.Trigger. |
| Shift + Tab | When focus is on an Accordion.Trigger of an expanded section, focuses the previous Accordion.Trigger. |
| ArrowDown | When focus is on an Accordion.Trigger of a collapsed section, focuses the next Accordion.Trigger. |
| ArrowUp | When focus is on an Accordion.Trigger of an expanded section, focuses the previous Accordion.Trigger. |
| Home | When focus is on an Accordion.Trigger, focuses the first Accordion.Trigger. [TODO] |
| End | When focus is on an Accordion.Trigger, focuses the last Accordion.Trigger. [TODO] |