Accordion
A vertical stack of expand/collapse disclosure panels.
Signature
Density
Viewport
Theme and light/dark are set in the top barWhen to use
A vertical stack of expand/collapse disclosure panels.
Accessibility
Arrow keys move between items; the current item is marked aria-current. Tabs follow the WAI-ARIA tabs pattern (roving tabindex, Home/End).
Install and import
npx shadcn@latest add @prism/accordion
import { Accordion } from '@/components/prism/Accordion';
In a no-build prototype, read it from the bundle instead: const { Accordion } = window.PrismDesignSystem_39d121;
Props
| Prop | Type | Required | Description |
|---|---|---|---|
items | AccordionItem[] | Yes | |
expandedKeys | string[] | — | Controlled: the ids of the open items. Pair with onExpandedChange. |
defaultExpandedKeys | string[] | — | Uncontrolled: the ids open at first. |
onExpandedChange | (keys: string[]) => void | — | Fired with the ids that should be open after a header is pressed. |
allowMultiple | boolean | — | Keep multiple panels open at once. Default false (one at a time). |
keepMounted | boolean | — | Keep closed panels in the DOM (hidden) so form fields inside them still submit and keep their state. Default true; false unmounts closed panels. |
className | string | — |