Skip to content

Accordion

A vertically stacked set of interactive headings that each reveal a section of content.

  • stable
  • since v0.1.0
  • 2.9 kB
  • disclosure
  • accordion
  • accessible

Uses role="region" + aria-expanded on triggers; keyboard navigable with Enter/Space; focus moves between triggers with Tab.

Preview
Open
tsx

Use type="multiple" to allow several items to be expanded simultaneously.

Preview
Open
tsx

Pass disabled to any AccordionItem to prevent it from being expanded.

Preview
Open
tsx
PropTypeDefaultDescription
type*
"single"|"multiple"
value
string|string[]
defaultValue
string|string[]
onValueChange
((value: string) => void) | ((value: string[]) => void)
collapsible
boolean
Force a non-empty selection in single mode.
disabled
boolean
className
string
variant
"default"|"contained"|"ghost"
"default"
Visual treatment. `default` shows divider lines, `contained` renders each item as a separate bordered card, `ghost` removes all chrome.
size
"sm"|"md"|"lg"
"md"
Controls trigger padding, font size, and chevron size.
  • Each AccordionTrigger is a <button> with aria-expanded wired by the component.
  • The content region carries role="region" and is linked to its trigger via aria-labelledby.
  • Enter or Space toggles the focused item; Tab moves focus between triggers.
  • Disabled items carry aria-disabled="true" and are skipped by keyboard navigation.
  • The chevron icon is aria-hidden="true" — it is purely decorative.
  • Use variant="contained" for a bordered card-style accordion.
  • Use variant="ghost" for a minimal look without visible borders.
  • Set collapsible on type="single" to allow the active item to be toggled closed.
  • Use hideIndicator on AccordionTrigger to remove the built-in chevron when you supply a custom indicator.
  • Combine with size="lg" for more generous padding in spacious layouts.