shadcn.io is not affiliated with official shadcn/ui
Collapsible examples · Sidebar
Sidebar with Counts Collapsible for React
An Inbox sidebar item with a count badge that expands to Unread and Starred links with their own counts.
A sidebar folder that shows its count before it opens. Inbox carries a secondary badge with 12, and opens to Unread and Starred links, each with an outline count, indented beside a start-edge line. Use it for mail, tickets or any folder with unread items.
Preview
Installation
FAQ
Which badge is 12, and which are 8 and 4?
12 is a secondary Badge at the end of the Inbox trigger. 8 and 4 are outline badges at the end of the Unread and Starred links.
What is the line beside Unread and Starred?
The links' nav has ms-6 border-s ps-3: a start border that follows the page direction, indented to sit under the Inbox label.
Do Unread and Starred expand too?
No. They're links, built from the folders list at the top of the file. Only Inbox is a trigger.
Does 12 get announced with Inbox?
Yes. The badge is inside the trigger, so the name is Inbox 12. Add visually hidden text, such as unread, if the number needs explaining.
Related
- Nested Sidebar Items CollapsibleA two-level sidebar tree where
- Settings Menu CollapsibleA Preferences menu with a settings icon
- Card with Badge CollapsibleA card whose Premium Features header
- Minimal Sidebar Group CollapsibleA sidebar group with a small uppercase
- Badge with Text (Secondary)A secondary badge with a muted label for
- FAQ with Badge CollapsibleAn FAQ question with a Popular badge and