Accordion
ImplementedVertical stack of expandable sections. Single or multi-expand modes. Each header is a button with aria-expanded.
patterns/molecules/accordion.htmlVertical, keyboard-friendly disclosure list. Each item has a single-button header and an animated panel; arrows, Home, and End keys navigate the headers; Space/Enter toggles the panel. NASA Rule 2 governs: between 2 and 10 items, duplicate ids warn in dev.
Accordion
Content & Layout — Family 6
Uncontrolled disclosure list. Pass defaultOpenId to open a single item on first mount, or set defaultOpen on individual items — the component manages open state internally (there is no controlled API). Multiple open panels are supported via the multiple flag.
Usage
Accordion is the canonical disclosure list for FAQ-style content. Provide an accessible name via ariaLabel so screen-reader users get the context.
import { Accordion } from '@epasslive/design-system'
<Accordion
items={[
{ id: 'one', title: 'Question 1', content: <p>Answer 1</p> },
{ id: 'two', title: 'Question 2', content: <p>Answer 2</p> },
]}
ariaLabel="FAQ"
multiple={false}
/>Keyboard shortcuts
ArrowDown/ArrowUp— move focus to the next / previous header.Home/End— focus the first / last header.Space/Enter— toggle the focused panel.
Props
items*AccordionItem[]Items to render. Each has id, title, content, plus optional defaultOpen and disabled flags.
multiplebooleanWhen true, multiple panels can be open at once. When false, opening one panel closes the others. Defaults to false.
ariaLabel*stringAccessible label for the accordion. Surfaced to assistive tech.
classNamestringAdditional classes appended to the root container.
idstringOptional id for the root container. Defaults to a useId-derived value.
defaultOpenIdstringWhen provided, that item is open on first mount (single-open mode).
Props
Accordion
itemsAccordionItem[]—2-10 items
multiplebooleanfalseAllow several panels open at once. When false, opening a panel closes the others; on mount the first open candidate wins.
ariaLabelstring—Accessible name for the group root (role='group'). No default — every consumer must pass one.
classNamestring—Class appended to the root group container.
idstringuseId()Stable id base for the root; item button/panel ids are derived from it.
defaultOpenIdstring—Id of the panel open on mount. Takes precedence over per-item defaultOpen flags; ignored when the target item is disabled.
<Accordion />Accessibility
Type
1 ruleARIA
1 ruleUsage
Import
import { Accordion } from "@epasslive/design-system"Example 1
<Accordion items={faqItems} ariaLabel="Frequently asked questions" />Example 2
<Accordion items={settingsSections} multiple ariaLabel="Settings sections" />Anti-patterns
— Do not ship collapsed panels containing focusable children (panels stay in the DOM with aria-hidden)
— Keep items within 2-10 — the component warns outside that range (NASA Rule 2)
— Do not omit ariaLabel — the group root has no default accessible name