Components
Sidebar
A composable, collapsible application sidebar — header, grouped menu, and footer, paired with the main content via SidebarInset.
Canonical pattern. The full fe-distillery primitive ships 14 variants (mobile sheet, rail, floating/inset, skeletons, badges, …). This documents the one primary pattern most apps should reach for — the others compose from the same parts.
Preview
Live and interactive — hit the toggle to collapse to an icon rail, then switch the theme. Every surface, the active-item highlight, and the brand badge remap from Cognition tokens, no dark: classes.
API
<SidebarProvider>
<Sidebar>
<SidebarHeader>{/* brand */}</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarGroupLabel>Platform</SidebarGroupLabel>
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton isActive>
<LayoutDashboard />
<span>Overview</span>
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroup>
</SidebarContent>
<SidebarFooter>{/* user */}</SidebarFooter>
</Sidebar>
<SidebarInset>
<SidebarTrigger />
{/* page content */}
</SidebarInset>
</SidebarProvider>SidebarProvider owns the expanded/collapsed state (read it with useSidebar); SidebarMenuButton takes isActive and asChild (wrap a Link). Collapsed, button labels and sub-menus hide automatically.
Don't and Do
Don't hand-roll a fixed aside with bg-gray-50 and ad-hoc collapse state — you'll miss the shared active styling, keyboard focus, and token theming. Compose the provided parts.
<SidebarMenuButton asChild isActive={pathname === "/"}>
<Link href="/"><LayoutDashboard /><span>Overview</span></Link>
</SidebarMenuButton>import {
SidebarProvider,
Sidebar,
SidebarHeader,
SidebarContent,
SidebarGroup,
SidebarGroupLabel,
SidebarMenu,
SidebarMenuItem,
SidebarMenuButton,
SidebarMenuSub,
SidebarMenuSubItem,
SidebarMenuSubButton,
SidebarFooter,
SidebarInset,
SidebarTrigger,
} from "@/components/ui/sidebar";Wrap the app in SidebarProvider, place a SidebarTrigger in your header, and put page content in SidebarInset.