Skip to content
Browse docs and components

Accordion

accordion

Collapsible sections on the Base UI primitive, with headings a screen reader can list, arrow-key navigation between triggers and a height that animates to the measured content.

Responsive

Install

$npxshadcnadd@forme/accordion

Adds the component, its registry dependencies, and the token stylesheet you import once.

Usage

import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/forme/accordion/accordion";

<Accordion>
  <AccordionItem value="refunds">
    <AccordionTrigger>Can I get a refund?</AccordionTrigger>
    <AccordionContent>Within 14 days, no questions asked.</AccordionContent>
  </AccordionItem>
</Accordion>

When to use

Reach for it

  • Lists of questions or sections where a reader wants one or two, like an FAQ or optional settings.

Use something else

  • Content most people need to read — hiding it behind a click only adds work.
  • Switching between peers of equal weight; that is Tabs.

API reference

Read from the source, so it is the API of the file you install. A prop marked * is required.

Parts

  • AccordionTakes Base UI Accordion.Root
  • AccordionItemTakes Base UI Accordion.Item
  • AccordionTriggerTakes Base UI Accordion.Trigger
  • AccordionContentTakes Base UI Accordion.Panel

Accessibility

  • Each header is an <h3> holding its button, so a screen reader's heading list doubles as a table of contents.

Motion

  • Panels open to the height Base UI measures, and the chevron turns rather than swapping icons.