shadcn.io is not affiliated with official shadcn/ui
Accordion examples · Multi Level
Multi-Level Nested Accordion for React
An accordion of help center topics where each open section lists its articles as collapsibles that expand on their own.
Some content has two levels: topics, and articles within them. This React example puts Collapsible rows inside each AccordionContent, so a topic opens to a list of articles that each open on their own, with a chevron that turns over. One topic is open at a time; any number of articles can be. Use it for help centers and documentation.
Preview
Installation
FAQ
Why are the articles a Collapsible?
Each article is a Collapsible inside AccordionContent, with its own CollapsibleTrigger. The parent rows stay an Accordion, so each level toggles on its own.
How does an article chevron rotate?
The CollapsibleTrigger has className="group". Its ChevronDownIcon uses group-aria-expanded:rotate-180 and duration-200, with opacity-60 and aria-hidden.
How are the article rows styled?
AccordionContent is p-0, so the rows run to the item edges. Each Collapsible has border-t and bg-accent, and CollapsibleContent uses ps-6 with text-sm text-muted-foreground.
Why does Account start open?
defaultValue={["account"]} opens Account on first render. The string matches that item's value.
Related
- Multi-Level Accordion with IconsAn accordion of workspace sections with a
- Multi-Level Accordion with Plus/Minus TriggerAn accordion of help center topics with a
- Multi-Level Accordion with Left Plus TriggerAn accordion of help center topics with a
- Standard Accordion with ChevronA bordered accordion of three questions
- Card CollapsibleA card with a Features header that
- Accordion with Subtitle TextA bordered accordion of help topics where