Accordion
Stacked disclosure panels with rotating chevrons. Only the trigger is focusable — closed panels are unmounted.
Install
Install the component
Add the source straight into your project with the shadcn CLI — no package dependency to track.
npx shadcn@latest add https://vert-ui.dev/r/accordion.jsonPreview
Live preview
Add only the components you need. The CLI copies the source directly into your project:
npx shadcn@latest add https://vert-ui.dev/r/accordion.jsonUsage
Examples
Multiple panels open
Invoices are issued on the 1st of each month.
<Accordion type="multiple">
<AccordionItem value="billing">
<AccordionTrigger>Billing</AccordionTrigger>
<AccordionContent>…</AccordionContent>
</AccordionItem>
<AccordionItem value="usage">
<AccordionTrigger>Usage</AccordionTrigger>
<AccordionContent>…</AccordionContent>
</AccordionItem>
</Accordion>Bordered variant
Rounded border around each item.
<Accordion type="single" variant="bordered" collapsible>…</Accordion>Sizes
Tighter padding for compact layouts.
More room to breathe with a larger label.
<Accordion type="single" size="sm">…</Accordion>
<Accordion type="single" size="lg">…</Accordion>Custom or hidden indicator
// Right-aligned plus/minus
<Accordion indicator={<span aria-hidden>+</span>}>…</Accordion>
// Indicator on the left
<Accordion indicatorPosition="start">…</Accordion>
// No indicator
<Accordion indicator={false}>…</Accordion>Reference
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| type(required) | "single" | "multiple" | — | Whether one panel or several can be open at once. |
| collapsible | boolean | false (single) | Lets the open item close itself when clicked again. |
| value / defaultValue | string | string[] | — | Controlled or uncontrolled open item(s). |
| onValueChange | (value: string | string[]) => void | — | Fires when the open set changes. |
| variant | "default" | "bordered" | "default" | Hairline dividers or boxed items. Cascades to every AccordionItem. |
| size | "sm" | "default" | "lg" | "default" | Trigger padding and label scale; also drives content spacing. |
| indicator | ReactNode | false | rotating chevron | Replaces the marker; pass false to hide it entirely. |
| indicatorPosition | "start" | "end" | "end" | Which side of the label the indicator sits on. |
| AccordionItem value(required) | string | — | Identifies the panel; must be unique. |
| AccordionTrigger size / indicator | same as root | — | Any trigger can override size, indicator and indicatorPosition per item. |
Accessibility
Accessibility notes
- Triggers are real buttons with aria-expanded and aria-controls; panels carry role="region" and aria-labelledby.
- In single mode the inactive panels are unmounted, so hidden content is never reachable.
- Panels reveal with a height + opacity animation driven by Radix's --radix-accordion-content-height; prefers-reduced-motion collapses it to instant.
- The indicator rotates with a transform-only 200ms transition, so custom markers animate the same way as the default chevron.
- Keep trigger labels specific ("How is vert-ui installed?", not "More").
- For long documents consider a heading-per-item navigation instead of an accordion.