Accordion
Accordion is a stack of Collapsibles linked through context. A type of single or multiple
decides whether opening one panel closes the others.
What it is
A compound component. Accordion.Root owns the set of open item ids and the open policy.
Accordion.Item wraps each section — it is a Collapsible
keyed to a stable value. Accordion.Trigger and Accordion.Content are Collapsible's Trigger
and Content, re-exported.
The type prop is the whole behavioural choice. single keeps at most one panel open — opening
a second closes the first. multiple lets any number stay open at once.
Install
Anatomy
API
Accordion.Root
Accordion.Root
stablefunction Accordion.Root(props: AccordionRootProps): JSX.Element
`single` keeps at most one item open. `multiple` allows any number open at once.
Controlled list of open item values. Pass alongside `onValueChange`.
Initially open item values for the uncontrolled mode.
Called whenever the set of open items changes.
The Item parts.
Accordion.Item
Accordion.Item
stablefunction Accordion.Item(props: AccordionItemProps): JSX.Element
A stable id for this item — what appears in the Root's open-value list.
The Trigger and Content parts for this section.
Accordion.Trigger / Accordion.Content
Collapsible's Trigger and Content, re-exported. See the
Collapsible API for their props.
Accessibility
Each item is a disclosure region — its trigger carries aria-expanded and aria-controls, its
content is a role="region" labelled by the trigger. A screen-reader user hears, for each
header, whether the panel is open and can step through them.
type="single" is closer to the WAI-ARIA accordion pattern; type="multiple" is a stack of
independent disclosures. Pick single when the sections are alternatives — an FAQ where one
answer at a time is enough — and multiple when a user may want to compare panels side by side.
Examples
A single-open FAQ:
A multi-open settings group: