Accordion
A vertically stacked set of interactive headings that each reveal a section of content.
Installation
npx shadcn@latest add @uqudo/accordionUsage
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/uqudo/ui/accordion"<Accordion type="single" collapsible>
<AccordionItem value="item-1">
<AccordionTrigger>Is it accessible?</AccordionTrigger>
<AccordionContent>Yes. It adheres to the WAI-ARIA design pattern.</AccordionContent>
</AccordionItem>
</Accordion>type="single" opens one item at a time; add collapsible so the open item
can be closed again. Use type="multiple" to let several items stay open.
Examples
Multiple
Several sections can be expanded at once. defaultValue takes an array in this
mode.
API Reference
Accordion
The root. Renders a bordered, rounded container and manages which items are open.
Prop
Type
AccordionItem
One collapsible section. Gets a bottom border except on the last item and a subtle background while open.
Prop
Type
AccordionTrigger
The clickable heading. Wraps AccordionPrimitive.Header and Trigger and
appends a chevron that flips between down and up as the item toggles.
Prop
Type
AccordionContent
The revealed panel. Animates its height on open and close; className is
applied to the inner padding wrapper.
Prop
Type
Data attributes
| Component | data-slot |
|---|---|
Accordion | accordion |
AccordionItem | accordion-item |
AccordionTrigger | accordion-trigger |
| Chevron icons | accordion-trigger-icon |
AccordionContent | accordion-content |