Accordion
Vertically stacked disclosure sections with animated height.
Because every component styles against roles, one file rebrands the whole system.
Install
npx shadcn@latest add https://plinth.dhrumilkherde.com/r/accordion.jsonUsage
import {
Accordion, AccordionItem, AccordionTrigger, AccordionPanel,
} from "@/components/ui/accordion";
<Accordion multiple={false} defaultValue={["first"]}>
<AccordionItem value="first">
<AccordionTrigger>Question</AccordionTrigger>
<AccordionPanel>Answer.</AccordionPanel>
</AccordionItem>
</Accordion>Props
Root: multiple (default true), value / defaultValue (array of open item
values), onValueChange, disabled. Item: value, disabled.
Accessibility
- Triggers are buttons inside heading elements with
aria-expanded; arrow keys move between triggers, Home/End jump. - The height animation uses the panel's measured height variable and respects reduced-motion preferences via the motion tokens.