20 shadcn Sidebar Examples: Official Blocks & Community Picks 2026

The shadcn/ui sidebar is one component with three switches — variant, collapse mode and side — and almost every “shadcn sidebar example” online is a combination of them. These 20 examples are the 15 official blocks, each shown and explained with the props that produce it, plus 5 community sources worth knowing.
Every official example installs with one command and is plain code in your repository afterwards. The docs now provide the sidebar for Radix UI, Base UI and React Aria, so the same patterns work whichever primitive library your project uses. Below the examples you will find the setup details most tutorials skip: how the open state persists, how to change widths, and what happens on mobile.
Related reading: shadcn/ui admin dashboard templates for complete apps, Next.js admin dashboards with shadcn/ui, and Bootstrap sidebars if your project is not on React.
Quick Picks
- SaaS dashboard default: sidebar-07 — team switcher, icon collapse, user menu
- Simplest start: sidebar-01 — grouped links, nothing to configure
- Long navigation: sidebar-05 — accordion sections with search
- Content as a card: sidebar-08 — the inset variant
- Mail and inbox tools: sidebar-09 — icon rail plus a list column
- Inspector panel: sidebar-15 — left and right sidebars together
- In a full admin: shadcn-admin — the official sidebar across ten-plus pages
The three props behind every example
Read these first and the examples become obvious. All three are props on the Sidebar component:
| Prop | Values | What changes | See |
|---|---|---|---|
variant | sidebar (default), floating, inset | Edge-to-edge panel, a floating rounded panel, or a sidebar beside an inset content card | 04, 08 |
collapsible | offcanvas (default), icon, none | Slides fully away, shrinks to an icon rail, or never collapses | 07, 09 |
side | left (default), right | Which edge it sits on | 14, 15 |
Everything else — submenus, dropdowns, file trees, calendars — is composition: SidebarHeader, SidebarContent, SidebarGroup, SidebarMenu and SidebarFooter filled with ordinary shadcn components.
Official shadcn/ui sidebar examples
All free and MIT-licensed, maintained by the shadcn/ui project, and installed with npx shadcn@latest add sidebar-NN, which also pulls in the sidebar component and any dependencies such as breadcrumb or collapsible. sidebar-02 (collapsible sections) is a close variation of sidebar-05 and is not shown separately.
1. sidebar-01: Navigation grouped by section
Grouped navigation

What it shows: The baseline: a header with a version switcher and search, then links grouped under section labels. No collapsing, no icons — the cleanest possible starting point.
Each section is a SidebarGroup with a SidebarGroupLabel; the active page uses isActive on SidebarMenuButton. Install: npx shadcn@latest add sidebar-01.
2. sidebar-03: Sidebar with submenus
Nested links

What it shows: Top-level items with their children always visible underneath, indented with a guide line. It suits documentation where readers scan the whole tree.
Children render in SidebarMenuSub and SidebarMenuSubButton; nothing collapses, so there is no extra state. Install: npx shadcn@latest add sidebar-03.
3. sidebar-04: Floating sidebar
variant=”floating”

What it shows: The same submenus, but the sidebar sits on the page as a rounded, bordered panel with a gap around it instead of running edge to edge.
One prop: variant="floating" on Sidebar. Install: npx shadcn@latest add sidebar-04.
4. sidebar-05: Collapsible submenus
Accordion navigation

What it shows: Sections open and close like an accordion, with a search field in the header, so a long navigation stays short until the user needs a part of it.
Each item is wrapped in the Collapsible component, with plus and minus icons swapped by the open state. Install: npx shadcn@latest add sidebar-05.
5. sidebar-06: Submenus as dropdowns
Dropdown submenus

What it shows: Children open in a dropdown beside the item instead of expanding in place, and a newsletter opt-in card sits in the footer. Good when the sidebar must stay a fixed height.
Uses DropdownMenu for the children and a Card with a form in SidebarFooter. Install: npx shadcn@latest add sidebar-06.
6. sidebar-07: Collapses to icons
collapsible=”icon”

What it shows: The SaaS-dashboard standard: a team switcher at the top, collapsible project groups, and a user menu at the bottom, collapsing to an icon rail with tooltips.
Set collapsible="icon" and give each SidebarMenuButton a tooltip so labels appear in the collapsed rail. Install: npx shadcn@latest add sidebar-07.
7. sidebar-08: Inset sidebar
variant=”inset”

What it shows: The main content sits in a rounded inset panel beside the sidebar, and the sidebar adds secondary navigation (support, feedback) pinned to the bottom.
Use variant="inset" and wrap the page in SidebarInset; secondary links go in a group with mt-auto. Install: npx shadcn@latest add sidebar-08.
8. sidebar-09: Collapsible nested sidebars
Two sidebars, one rail

What it shows: An icon rail chooses the section; a second, wider sidebar lists its items — the layout of a mail client, with an unread toggle in the second column.
A Sidebar nested inside a Sidebar, with the outer one at collapsible="icon". Install: npx shadcn@latest add sidebar-09.
9. sidebar-10: Sidebar in a popover
Popover navigation

What it shows: Workspace navigation with favourites and nested pages, and secondary actions opened from a popover in the header — the Notion pattern.
Combines Popover and Collapsible inside the sidebar header and groups. Install: npx shadcn@latest add sidebar-10.
10. sidebar-11: Collapsible file tree
File tree

What it shows: A recursive tree of folders and files with a changes list above it, the shape of an editor or a file-manager admin.
A recursive component renders Collapsible folders inside SidebarMenuSub to any depth. Install: npx shadcn@latest add sidebar-11.
11. sidebar-12: Sidebar with a calendar
Widgets in the sidebar

What it shows: A date picker and a list of calendars live in the sidebar, the layout of a calendar app where the sidebar controls the view rather than navigating.
Drops the Calendar component into SidebarContent; any component can live there. Install: npx shadcn@latest add sidebar-12.
12. sidebar-13: Sidebar in a dialog
Settings dialog

What it shows: A sidebar inside a modal, switching between settings pages — the pattern behind most modern “Settings” windows.
The whole provider and sidebar render inside Dialog, which shows the component is not tied to page layout. Install: npx shadcn@latest add sidebar-13.
13. sidebar-14: Sidebar on the right
side=”right”

What it shows: A table-of-contents sidebar on the right edge, with the trigger mirrored into the right of the header — the shape of a documentation page.
One prop: side="right" on the sidebar, placed after SidebarInset; the trigger gets rotate-180 so its icon points the right way. Install: npx shadcn@latest add sidebar-14.
14. sidebar-15: Left and right sidebars
Two panels

What it shows: Workspace navigation on the left and a calendars-and-date-picker panel on the right — the layout for an app with an inspector or activity column.
The left sidebar collapses as usual; the right one is a second Sidebar with collapsible="none", made sticky and shown only on large screens. Install: npx shadcn@latest add sidebar-15.
15. sidebar-16: Sticky site header
Header above the sidebar

What it shows: A full-width header with breadcrumbs and search sits above both the sidebar and the content, and the sidebar starts below it.
Sets the sidebar height from a header-height CSS variable so the two never overlap. Install: npx shadcn@latest add sidebar-16.
Community sidebar examples and libraries
Complete apps and block libraries that build on, or predate, the official component.
16. shadcn-admin
A full admin built around the official sidebar

Why it is here: The most-starred shadcn dashboard on GitHub uses the official Sidebar with a team switcher, collapsible icon mode and grouped navigation, plus a global command search and RTL support. It is the best place to see the component wired into ten-plus real pages.
Built with Vite rather than Next.js. Its author notes it is a UI collection, not a starter template, and that a few components are modified for RTL, so read its README before running the shadcn CLI over them.
17. shadcn-ui-sidebar (salimi-my)
Maintenance: last commit April 2025. The code is still usable, but the framework has shipped major releases since, so budget time to update dependencies yourself and check anything that touches build tooling.
The retractable mini/wide sidebar that predates the official one

Why it is here: Before shadcn shipped a Sidebar, this was the community answer, and it still ranks for the search. It is its own implementation — a retractable mini and wide sidebar with grouped menus, collapsible submenus and a sheet on mobile — with state held in Zustand, and it installs through the shadcn CLI from a registry URL.
It is built on Next.js 14 and is not the official component, so the official blocks’ props and docs do not apply. Choose it if you like its look; start from sidebar-07 if you want the official API.
18. blocks.so sidebars
Six free sidebar blocks, installable from a registry

Why it is here: An open-source block library with six free sidebar layouts — collapsible sections, an inset dashboard, a floating dashboard and two double-sided layouts, one of them mail-style — each installable with the shadcn CLI from its registry.
Useful as a second opinion on the official patterns: the double-sided layouts in particular are fuller than the official sidebar-15.
19. ReUI sidebar
Free sidebar components with Radix and Base UI support

Why it is here: ReUI’s sidebar page offers free sidebar components for dashboard navigation, documentation trees, project switchers and right-hand inspector panels, written to work with both Radix UI and Base UI composition and the shadcn style options.
The components are free to install; larger sidebar blocks sit in its paid Pro tier.
20. Shadcnblocks sidebars
The largest catalogue, mostly paid

Why it is here: Shadcnblocks lists more than twenty sidebar sections — workspace switchers, floating and inset shells, file trees, right-hand panels — alongside a full admin kit. It is the deepest catalogue if you want a finished, designed variant rather than a pattern.
Most of the catalogue is in the paid tier. We compare it with the other block libraries in shadcn/ui block libraries.
Setting up the shadcn sidebar: the details that trip people up
Install and wrap the app
npx shadcn@latest add sidebar
// app/layout.tsx
import { SidebarProvider, SidebarTrigger } from "@/components/ui/sidebar"
import { AppSidebar } from "@/components/app-sidebar"
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<SidebarProvider>
<AppSidebar />
<main>
<SidebarTrigger />
{children}
</main>
</SidebarProvider>
)
}
Keep the open state across reloads
The provider already writes its state to a cookie named sidebar_state, kept for seven days. To render the correct state on the server — and avoid the sidebar flashing open then shut — read the cookie in your layout and pass it as defaultOpen:
import { cookies } from "next/headers"
export default async function Layout({ children }: { children: React.ReactNode }) {
const cookieStore = await cookies()
const defaultOpen = cookieStore.get("sidebar_state")?.value === "true"
return (
<SidebarProvider defaultOpen={defaultOpen}>
<AppSidebar />
<main>{children}</main>
</SidebarProvider>
)
}
Change the width
The defaults are 16rem on desktop, 18rem for the mobile sheet and 3rem for the icon rail. Override the first two per provider with CSS variables, which also lets two sidebars on one page have different widths:
<SidebarProvider
style={{
"--sidebar-width": "20rem",
"--sidebar-width-mobile": "20rem",
} as React.CSSProperties}
>
Mobile, keyboard and theming
- Mobile: below 768px the sidebar renders inside a
Sheetdrawer, whatever its variant.useSidebar()exposesisMobile,openMobileandsetOpenMobilefor that state, separate from the desktopopen. - Keyboard:
Cmd+Bon Mac andCtrl+Bon Windows toggle it; the key is theSIDEBAR_KEYBOARD_SHORTCUTconstant insidebar.tsx. - Controlled state: pass
openandonOpenChangetoSidebarProviderwhen something else must drive it. - Colours: the sidebar has its own theme variables —
--sidebar,--sidebar-foreground,--sidebar-primary,--sidebar-accent,--sidebar-border,--sidebar-ringand their foregrounds — so it can be darker or tinted without touching the rest of the theme. - Hiding content when collapsed: style against the data attribute, for example
group-data-[collapsible=icon]:hiddenon a group that should vanish in the icon rail.
shadcn sidebar FAQ
How do I make the shadcn sidebar collapse to icons?
Set collapsible=”icon” on the Sidebar component and give each SidebarMenuButton a tooltip prop so its label shows when collapsed. The official sidebar-07 block is a complete example; install it with npx shadcn@latest add sidebar-07.
How do I keep the sidebar open or closed after a page reload?
SidebarProvider already saves its state to a cookie called sidebar_state. In a Next.js layout, read that cookie with cookies() and pass defaultOpen to SidebarProvider so the server renders the saved state.
How do I change the shadcn sidebar width?
Set the –sidebar-width and –sidebar-width-mobile CSS variables in the style prop of SidebarProvider. The defaults are 16rem on desktop and 18rem on mobile; the collapsed icon rail is 3rem.
Can I have a sidebar on the right, or two sidebars?
Yes. Set side=”right” on a Sidebar for a right-hand panel, as sidebar-14 does; sidebar-15 shows a left and a right sidebar on one page. Each SidebarProvider tracks a single open state, so two collapsible sidebars under one provider open and close together; sidebar-15 avoids that by making the right-hand panel non-collapsible.
How does the shadcn sidebar behave on mobile?
Below 768px it renders inside a Sheet, a slide-in drawer, regardless of variant. The useSidebar hook exposes isMobile and openMobile so you can control the drawer separately from the desktop state.
Does the shadcn sidebar work with Base UI?
Yes. The shadcn/ui docs provide the sidebar for Radix UI, Base UI and React Aria, and the blocks use the same composition in each.
Is the shadcn sidebar free?
Yes. The component and all official sidebar blocks are open source under the MIT licence. Some third-party block libraries, such as Shadcnblocks and ReUI’s Pro tier, sell additional designed variants.
Need the rest of the dashboard? Browse shadcn/ui admin dashboard templates or the wider shadcn/ui templates collection.


