Accordion
Use Accordion for related sections that readers can scan and expand as needed. Choose Collapsible for one independent section.
Preview
Component setup questions
Explore three questions about style tokens, editable source, and keyboard interaction, with the token answer open initially.
Installation
New to this Registry? Complete the base setup before continuing.
npx shadcn@latest add @neumorphism-ui/accordionInstall the shared base once, then add components and their dependencies with the CLI.
Usage
Place a trigger and content inside each AccordionItem, and give every item a stable, unique value. Set multiple when several answers should stay open together.
"use client";
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";
export default function Example() {
return (
<Accordion>
<AccordionItem value="shipping">
<AccordionTrigger>When will my order arrive?</AccordionTrigger>
<AccordionContent>Orders ship in 2–3 business days.</AccordionContent>
</AccordionItem>
</Accordion>
);
}API Reference
Preserves Base UI Accordion state management and accessibility relationships while rendering open items as inset surfaces. Supports both multiple selection and controlled or uncontrolled usage.
| Component | Prop | Type | Default | Description |
|---|---|---|---|---|
Accordion | multiple | boolean | false | Allows multiple items to remain open at the same time. |
Accordion | value / defaultValue | string[] | — | The controlled value or initial uncontrolled value of the open items. |
Accordion | onValueChange | (value) => void | — | Called when the set of open items changes. |
AccordionItem | valuerequired | string | — | A unique value that identifies the item. |
AccordionItem | disabled | boolean | false | Disables the item trigger. |
AccordionContent | keepMounted | boolean | false | Keeps the panel in the DOM while it is closed. |
Accessibility
- 01
Base UI manages the aria-expanded and aria-controls relationships between each trigger and panel.
- 02
Move focus to a trigger with Tab, then press Enter or Space to open or close the item.
- 03
AccordionTrigger renders a real button, so do not place another button inside its heading.