Accordion
stableA vertically stacked set of interactive headings that each reveal a section of content.
Basic usage
Examples
Multiple panels
Allow several panels to be open simultaneously.
Multiple open panels
Use type="multiple" for FAQ and settings pages where several sections can stay open.
Invoices, payment methods and tax details.
Two-factor authentication and audit logs.
Features
- Full keyboard navigation.
- Supports single or multiple expanded panels.
- Can be controlled or uncontrolled.
- Spring-eased height animation.
Installation
bash
pnpm dlx structyl add accordionAPI Reference
Accordion API reference
Full props, types, defaults, and all 5 parts.
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. |