Prodular UI

Sidebar

The main navigation of an app: workspace switcher, sections with counts, projects and the user menu, collapsible to icons.

npx prodular-ui add sidebar

App sidebar

Workspace switcher, main nav with counts, a projects group and the user menu. Press cmd+B or drag the rail to collapse.

Inbox24 open
  • Dana ReyesInvoices show the wrong VAT rate9:41
  • Marcus LeeSSO login loops on Safari9:12
  • Elif KayaCan we add a second billing contact?Yesterday
  • Jonas WeberWebhook retries stopped after deployYesterday
  • Sofia MarinExport to CSV drops custom fieldsMon

Icon mode

collapsible icon keeps a 48px rail. Labels move into tooltips.

Press the toggle or ⌘B to expand
Hover an icon to see its label.

Anatomy

<SidebarProvider>  <Sidebar collapsible="icon">    <SidebarHeader>{/* workspace switcher */}</SidebarHeader>    <SidebarContent>      <SidebarGroup>        <SidebarGroupLabel>Projects</SidebarGroupLabel>        <SidebarMenu>          <SidebarMenuItem>            <SidebarMenuButton render={<a href="/inbox" />} isActive tooltip="Inbox">              <InboxIcon />              <span>Inbox</span>            </SidebarMenuButton>            <SidebarMenuBadge>24</SidebarMenuBadge>          </SidebarMenuItem>        </SidebarMenu>      </SidebarGroup>    </SidebarContent>    <SidebarFooter>{/* user menu */}</SidebarFooter>    <SidebarRail />  </Sidebar>  <SidebarInset>{/* page */}</SidebarInset></SidebarProvider>

Guidance

Use it when

  • Use as the primary navigation of an app with more than four sections.
  • Put the workspace or account switcher in SidebarHeader and the user menu in SidebarFooter.
  • Show counts that need attention with SidebarMenuBadge: unread, assigned, failing.

Avoid

  • Marketing sites. Use Navigation menu.
  • Badges on every item. Only show counts people act on.
  • Deep nesting. One level of SidebarMenuSub is the limit.

Rules for AI agents

Published in llms-full.txt, the registry and the MCP server, so coding agents follow them when they build with this component.

  • Wrap the app in SidebarProvider and put Sidebar and SidebarInset inside it, as siblings.
  • Use collapsible="icon" for apps people use all day, and give every SidebarMenuButton a tooltip so the icon rail stays usable.
  • Mark the current page with isActive on SidebarMenuButton. Only one item is active.
  • Render links with render={<a href="..." />} or your router's Link. The default element is a button.
  • Every SidebarMenuButton starts with a 16px lucide icon followed by a <span> label, so the label truncates and hides in icon mode.
  • Place SidebarMenuBadge and SidebarMenuAction after the button inside the same SidebarMenuItem.
  • To show the sidebar inside a framed preview instead of the full viewport, give SidebarProvider a fixed height with className="relative h-120 min-h-0" and Sidebar className="absolute h-full".

API

SidebarProvider

PropTypeDefaultDescription
defaultOpen / open / onOpenChangebooleantrueExpanded state. Persisted in the sidebar_state cookie.

Sidebar

PropTypeDefaultDescription
collapsible"offcanvas" | "icon" | "none""offcanvas"How it collapses on desktop.
variant"sidebar" | "floating" | "inset""sidebar"floating and inset detach it from the edge.
side"left" | "right""left"Screen edge.

SidebarMenuButton

PropTypeDefaultDescription
isActivebooleanfalseCurrent page. Adds the accent fill and medium weight.
size"sm" | "default" | "lg""default"lg (48px) is for the workspace switcher and the user row.
tooltipstring | TooltipContentPropsShown only when the sidebar is collapsed to icons.

SidebarMenuAction

PropTypeDefaultDescription
showOnHoverbooleanfalseHides the action until the item is hovered or focused.

Installation

The Prodular UI CLI adds the source to components/ui with everything it depends on. In a project that already uses shadcn/ui, the shadcn CLI installs it from the Prodular registry too. See Installation for the first setup.

npx prodular-ui add sidebar# or, with the registry in components.jsonnpx shadcn@latest add @prodular/sidebar