Make your AI a shadcn expert

Shadcn Sidebar

React sidebar for app shells and dashboard navigation. Built with TypeScript and Tailwind CSS for Next.js using Base UI — collapsible rail, mobile sheet, Cmd+B.

A sidebar is the persistent nav column in an app shell. SidebarProvider owns the open state, writes a cookie, and binds Cmd/Ctrl+B. On a phone the same tree becomes a Sheet.

Scroll to load preview...

Looking for a neobrutalism version for shadcn?

Same sidebar, thicker borders. The NeoBrutalism sidebar is the kit if you want that look.

Usage

import {
  Sidebar,
  SidebarContent,
  SidebarFooter,
  SidebarGroup,
  SidebarHeader,
  SidebarMenu,
  SidebarMenuButton,
  SidebarProvider,
  SidebarRail,
  SidebarTrigger,
} from "@/components/ui/sidebar"
<SidebarProvider>
  <Sidebar>
    <SidebarHeader>Acme</SidebarHeader>
    <SidebarContent>
      <SidebarGroup>
        <SidebarMenu>
          <SidebarMenuButton>Inbox</SidebarMenuButton>
        </SidebarMenu>
      </SidebarGroup>
    </SidebarContent>
    <SidebarFooter />
    <SidebarRail />
  </Sidebar>
  <main>
    <SidebarTrigger />
  </main>
</SidebarProvider>

collapsible is offcanvas (slides away), icon (a rail), or none (static). Put the provider in the layout — SidebarTrigger reads it.

Composition

SidebarHeader
SidebarMenuButton
SidebarFooter
SidebarRail
SidebarTrigger

RTL

Wrap with DirectionProvider and dir="rtl". Pass dir on Sidebar so the mobile sheet flips with the page.

Scroll to load preview...

API

Prop

Type

Prop

Type

useSidebar

Prop

Type

useSidebar throws outside SidebarProvider.

Keyboard

KeyAction
⌘B / Ctrl+BToggle the sidebar

Notes

The provider has to wrap

useSidebar and SidebarTrigger throw if they sit outside SidebarProvider. Put the provider in the layout, not around a single menu item.

collapsible="none" is what the preview uses. The other modes position: fixed to the viewport.

With other components

Questions

Was this page helpful?

Sign in to leave feedback.