Skip to content

Accordion

Stacked sections that expand to reveal content: FAQs, grouped settings.

  • Content people need to compare side by side.
  • A single disclosure: a Collapsible is lighter (Wave 3).

Install

Terminal
pnpm dlx shadcn@latest add @acme/accordion

Or import from the package: import { Accordion } from '@acme/react'

Examples

Basic

accordion-basic.tsx
import {
  Accordion,
  AccordionContent,
  AccordionItem,
  AccordionTrigger,
} from '@/components/ui/accordion'

const faqs = [
  [
    'Can I change plans later?',
    'Yes. Upgrades apply immediately; downgrades apply at the next renewal.',
  ],
  ['Do you offer refunds?', 'Annual plans can be refunded within 30 days of purchase.'],
  [
    'Where is my data stored?',
    'In the EU (Frankfurt) or the US (Virginia), chosen when you create the workspace.',
  ],
]

export default function AccordionBasic() {
  return (
    <Accordion className="max-w-lg">
      {faqs.map(([q, a]) => (
        <AccordionItem key={q}>
          <AccordionTrigger>{q}</AccordionTrigger>
          <AccordionContent>{a}</AccordionContent>
        </AccordionItem>
      ))}
    </Accordion>
  )
}

Props

Accordion props
PropTypeDefaultDescription
multiplebooleanfalseAllow several items open at once.
value / defaultValuearray—Open items.
AccordionTrigger.headingLevel2 | 3 | 4 | 5 | 63Heading level of each item header.

Accessibility

Keyboard
KeyAction
Enter / SpaceToggles the section
Arrow Up / DownMoves between headers
Home / EndFirst / last header
Role
heading > button (aria-expanded) + region
You provide
  • A headingLevel that fits the page outline.
Built in
  • Height animation is removed under reduced motion.
WCAG 2.2 criteria
1.3.1, 2.1.1, 4.1.2

Don’t

  • Hide the primary content of a page in an accordion.

Tokens

  • color.border
  • color.muted-foreground
  • color.ring