Accordion
Coordinate one or several expandable sections with shared disclosure rules.
Use Accordion for several related disclosures that share one open-item policy. For a single independent disclosure, use Collapsible.
Basic usage#
Playground#
Anatomy#
Usage#
Open items#
Use an array of values for value, defaultValue, and onChange in both modes. Single mode opens at most one item; set multiple to allow several. In controlled usage, pair value with onChange. collapsible determines whether the currently open item may be closed.
Content lifetime#
The content shell stays mounted so each trigger’s aria-controls always points to a real element. unmountOnHide controls only the user content inside that shell. Choose based on whether hidden controls need to preserve local state.
Keyboard interaction#
| Key | Description |
|---|---|
| ↵ / Space | Toggles the focused trigger when enabled. |
| ↓ | Moves focus to the next enabled trigger. |
| ↑ | Moves focus to the previous enabled trigger. |
| ↖ | Moves focus to the first enabled trigger. |
| ↘ | Moves focus to the last enabled trigger. |
Examples#
Single item#
Multiple items#
Disabled and custom content#
Attributes#
data-disabledSlot: accordion, accordion-item, accordion-triggerDescription: Present when the component, slot, or item is disabled.data-closedSlot: accordion-item, accordion-trigger, accordion-contentDescription: Present when disclosure or transition content is closed.data-expandedSlot: accordion-item, accordion-trigger, accordion-trailing, accordion-contentDescription: Present when the panel, accordion, or menu is expanded.Props#
Props for the Accordion component. Renders a <div> element by default.