Overview
A vertically stacked set of disclosure regions. The Accordion parent owns expansion state and provides a context the AccordionItem children read.
Usage
Accordion is a compound component. Import the parent and compose
Accordion.Item via the namespace API.
The leaf remains importable individually for à-la-carte builds — see
@lostgradient/cinder/accordion-item.
Accordion vs Collapsible
Collapsible is the single-panel counterpart to Accordion.
Use Accordion when you have multiple named sections sharing a parent, and opening one may close another. The panels intentionally omit role="region" to avoid polluting the page's landmark list — see accordion.a11y.md.
Use Collapsible for a single independent disclosure that benefits from a named landmark region, animated open/close, or a trigger label that reacts to state.
Why AccordionItem does not compose Collapsible
AccordionItem and Collapsible differ in enough dimensions that sharing internals would require adding an accordion-mode flag to Collapsible or removing role="region" conditionally — either change would alter Collapsible's public API and bleed accordion-specific concerns into a general-purpose primitive. Instead, they share the same visual vocabulary (heading button + chevron icon + panel) while keeping their semantics separate. See collapsible.a11y.md for a side-by-side comparison.
When to use
- Progressively disclosing several sections of content that share a parent heading.
- Letting the consumer expand one or multiple panels at once via the multiple prop.
- Switching between mutually exclusive views of the same region. Use Tabs instead
- Hiding a single optional region — reach for a plain disclosure instead. Use Collapsible instead
Examples
Basic accordion
Single-select: opening one item closes the others. Uses the Accordion namespace API.
Dense inspector accordion
Inspector panels can compact trigger and panel spacing with public Accordion.Item CSS variables.
Disabled item
A disabled Accordion.Item cannot be toggled.
Multiple open
With multiple={true}, any number of items can be open at once.
Props
| Name | Type | Default | Required | Bindable | Description |
|---|---|---|---|---|---|
multiple | boolean | false | When true, multiple items may be expanded simultaneously. | ||
expandedIds | string[] | [] | bind | The currently expanded item IDs. Bindable. | |
children | snippet | req | AccordionItem children. |