Skip to content
Wave 3

Sidebar

App navigation in a vertical column. Server-component safe.

  • Marketing-site navigation: use Navigation Menu.

Install

Terminal
pnpm dlx shadcn@latest add @acme/sidebar

Or import from the package: import { Sidebar } from '@acme/react'

Examples

Basic

Page content
sidebar-basic.tsx
import { FileText, Home, Settings, Users } from 'lucide-react'
import {
  Sidebar,
  SidebarFooter,
  SidebarGroup,
  SidebarHeader,
  SidebarItem,
} from '@/components/ui/sidebar'

export default function SidebarBasic() {
  return (
    <div className="flex h-80 w-full max-w-2xl overflow-hidden rounded-lg border border-border">
      <Sidebar label="Workspace">
        <SidebarHeader className="text-headline">Northwind</SidebarHeader>
        <SidebarGroup label="Workspace">
          <SidebarItem href="#home" icon={<Home />} active>
            Home
          </SidebarItem>
          <SidebarItem href="#invoices" icon={<FileText />}>
            Invoices
          </SidebarItem>
          <SidebarItem href="#customers" icon={<Users />}>
            Customers
          </SidebarItem>
        </SidebarGroup>
        <SidebarFooter>
          <SidebarGroup>
            <SidebarItem href="#settings" icon={<Settings />}>
              Settings
            </SidebarItem>
          </SidebarGroup>
        </SidebarFooter>
      </Sidebar>
      <div className="flex-1 p-6 text-body-sm text-muted-foreground">Page content</div>
    </div>
  )
}

Props

Sidebar props
PropTypeDefaultDescription
label (required)string—Names the navigation landmark.
SidebarGroup.labelstring—Group heading.
SidebarItem.activeboolean—Marks the current page (aria-current="page").
SidebarItem.iconReactNode—Decorative icon.
SidebarItem.renderReactElement—Router link: render={<NextLink href="/" />}.

Accessibility

Keyboard
KeyAction
TabMoves through links
Role
navigation with links
You provide
  • label (enforced by TypeScript).
  • Every SidebarItem inside a SidebarGroup (items are list items).
Built in
  • The current page is marked with aria-current="page" and a fill, not color alone.
  • On small screens, render the same content inside a Sheet.
WCAG 2.2 criteria
1.3.1, 2.4.8, 1.4.1

Don’t

  • Nest more than two levels.

Tokens

  • color.border
  • color.accent
  • color.muted-foreground