Accordion
A stack of headings that each open to show more. Use it for questions and answers, or for settings that would otherwise make a long page. Built on Radix, with shadcn's API.
Install
npx shadcn@latest add @nelumbo/accordionPlain, one open at a time
type="single" with collapsible lets the open item close again. Rows sit on the surface and are spaced apart, with no divider lines.
Orders leave the studio within a day. Delivery takes two to four working days in the EU and the UK, and five to eight elsewhere. You get a tracking link as soon as it ships.
Segmented, several open
variant="segmented" puts each item on its own tile, like List. The open tile is a touch more prominent and rounds all round. type="multiple" lets any number stay open; icon and description add a leading symbol and a second line.
Plain, with icons
The plain variant takes icons and descriptions too. Keyboard: Tab to a heading, Enter or Space to open it, Up and Down to move between headings, Home and End to jump.
Usage
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion"// shadcn's API<Accordion type="single" collapsible> <AccordionItem value="shipping"> <AccordionTrigger>How long does shipping take?</AccordionTrigger> <AccordionContent>Two to four working days.</AccordionContent> </AccordionItem></Accordion>// Nelumbo: tiles, an icon and a description<Accordion type="multiple" variant="segmented"> <AccordionItem value="display"> <AccordionTrigger icon="palette" description="Theme, text size">Display</AccordionTrigger> <AccordionContent inset>...</AccordionContent> </AccordionItem></Accordion>Props
| Prop | Type | Default | Radix's own props (type, collapsible, value, defaultValue, onValueChange) work as is |
|---|---|---|---|
Accordion variant | "plain" | "segmented" | "plain" | Segmented: each item on its own tile, 2px apart |
Accordion type | "single" | "multiple" | Required, from Radix | |
AccordionTrigger icon | IconName | A leading Material Symbol | |
AccordionTrigger description | ReactNode | A quieter line under the title | |
AccordionContent inset | boolean | false | Indent to line up with the title when the trigger has an icon |
AccordionItem disabled | boolean | false | From Radix |