Demos

One item open at a time. The first item starts open.

Usage

Use an accordion to shorten a long page of related sections, such as FAQs or grouped biomarkers. Do not hide content the reader needs to compare side by side. If every section matters on first read, show them all.

Import it from @workspace/ui/components/accordion.

Anatomy

  • Accordion — The bordered container. Holds the open state.
  • AccordionItem — One section. Needs a unique value.
  • AccordionTrigger — The heading button. The plus and minus icons are added for you.
  • AccordionContent — The panel that opens and closes. className goes on the inner wrapper, not the panel.

Notes

  • defaultValue and value are arrays, even when only one item can be open.
  • Keep trigger text short and specific. It is read aloud as a button.
  • A disabled item stays visible but cannot be opened.

Examples

Multiple

Set multiple so several items can stay open at once.

Disabled

A disabled item stays visible but cannot be opened.

Props

These are the props you set most often. Unlisted props pass through to the underlying element.

Accordion

PropTypeDefaultDescription
defaultValueany[]—Items open on first render.
valueany[]—Open items when controlled.
onValueChange(value) => void—Called when an item opens or closes.
multiplebooleanfalseAllow more than one item open at once.
disabledbooleanfalseDisables every item.
classNamestring—Classes merged onto the element.

AccordionItem

PropTypeDefaultDescription
valueany—Identifies the item in the open state.
disabledbooleanfalseStops this item from opening.