Accordion
A vertically stacked set of interactive headings that each reveal a section of content — keyboard navigable, animated, and honest about it.
Installation#
pnpm dlx shadcn@latest add @davinciui/accordionUsage#
Powered by Base UI primitives: triggers expose aria-expanded, panels are labelled regions, and arrow keys move focus between headings. Panels animate with pure CSS grid rows — no height measurement, and reduced-motion users get an instant toggle.
Accordion
└── AccordionItem
├── AccordionTrigger
└── AccordionContentComposition#
Use the following composition to build a Accordion:
Accordion
└── AccordionItem
├── AccordionTrigger
└── AccordionContentAPI Reference#
| Prop | Type | Default |
|---|---|---|
multipleAllow more than one item open at once. | boolean | false |
valueControlled open value(s). Single mode uses a string. | string | string[] | — |
defaultValueUncontrolled initial open value(s). | string | string[] | — |
onValueChangeFires when the open value(s) change. | (value: string | string[]) => void | — |
disabledDisable the whole accordion, or one item. | boolean | false |
variantDivider rows, bordered container, or lifted cards. | "default" | "bordered" | "card" | "default" |
value (item)Unique value identifying the item. | string | — |
hideIconHide the chevron indicator on the trigger. | boolean | false |
keepMountedKeep panel mounted when closed (find-in-page support). | boolean | false |
classNameAdditional CSS classes. | string | — |
Accessibility#
Triggers are native buttons in headings with aria-expanded; arrow keys move focus between them and panels are labelled. Focus-visible rings are provided, and disabled items are skipped. Content remains mounted only when keepMounted is set.
Motion#
Panel height animates via grid-template-rows: 300ms ease-out opening and 200ms closing, while inner content fades and shifts with a 75ms open delay. The chevron rotates 300ms. The motion-reduce variant disables these transitions.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

