Text
Accordion
Published on
Description
An accordion groups related disclosure widgets so that opening one collapses the others. This design system uses native <details> elements with the name attribute for exclusive behavior.
Example
Example (class="chevron")
Accessibility
- Each
<summary>acts as a button with browser-managedaria-expandedstate. - The accordion group should be wrapped in an element with
role="group"for screen reader context. <summary>neutralizes nested heading semantics. Content headings should be placed inside the revealed content, not in the summary.- JavaScript is needed if you require keyboard shortcuts (e.g. Home/End) beyond the browser defaults.
References
- Disclosure Widgets (opens in new tab) — Adrian Roselli
- Details / Summary Are Not [insert control here] (opens in new tab) — Adrian Roselli
- CSS-only Widgets Are Inaccessible (opens in new tab) — Adrian Roselli
Related
- Disclosure — for standalone show/hide
- Dialog — for modal content
Variables
None for accordion