shadcn.io is not affiliated with official shadcn/ui
Accordion examples · Multi Level
Multi-Level Accordion with Left Plus Trigger for React
An accordion of help center topics with a plus/minus toggle at the start of each trigger, whose sections list their articles as nested collapsibles.
A help center in two levels, with the toggle first. Each topic's trigger starts with a plus that turns into a minus, and inside it the articles are Collapsible rows with their own chevrons that open independently. Use this React example for file-tree-like navigation and knowledge bases.
Preview
Installation
FAQ
How does the plus end up before the parent title?
The plus and minus sit in a relative size-4 box, the first child of a gap-3 row, with the title after it in flex-1 text-start. **:data-[slot=accordion-trigger-icon]:hidden hides the built-in chevron. group-aria-expanded/accordion-trigger fades the plus out and the minus in over duration-200, and both icons are aria-hidden.
What toggles an article?
Each article is a Collapsible inside AccordionContent. Its ChevronDownIcon sits on CollapsibleTrigger and uses group-aria-expanded:rotate-180 with duration-200.
How are the article rows styled?
AccordionContent is p-0. 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 Plus/Minus TriggerAn accordion of help center topics with a
- Multi-Level Nested AccordionAn accordion of help center topics where
- Multi-Level Accordion with IconsAn accordion of workspace sections 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