accordion
A vertical stack of headings that each expand or collapse a panel of content.
In more detail
Each heading contains a button with aria-expanded and aria-controls. Accordions may allow one or several panels open at once, and are a classic compound component.
Example
In the browser: Accordions save space on long pages by letting users open only the sections they need. An accessible accordion uses a real button, toggles aria-expanded and links the button to its panel with aria-controls.Related terms
- disclosure — A button that shows or hides a section of content, with aria-expanded on the button and aria-controls pointing at the section.
- compound component — A set of components designed to be used together, such as Tabs, Tabs.Trigger and Tabs.Panel, that share state behind the scenes.
- aria-expanded — An ARIA state on a button or trigger saying whether the content it controls is currently shown.
- ARIA states and properties — The aria-* attributes that describe an element's current condition or relationships, such as aria-expanded="true" or aria-controls="panel-1".
- widget — A self-contained interactive piece of an interface, such as a tab panel, date picker or accordion.
- hidden attribute — An HTML attribute that hides an element from display and from assistive technology, like display: none.
Taught in
- Headless Architecture: State vs Presentation Separation — Design Systems & Component Engineering
- Compound Component Patterns: Context Sharing & Internal State — Design Systems & Component Engineering
- Navigation & Disclosure: Dropdown Menus, Tabs & Accordions — Design Systems & Component Engineering
- Accessibility Tree, ARIA Roles, States And Live Regions — Frontend Architecture & Web Platform