What this thread does
The problem
Hand-written app shells tend to break on mobile, scroll the whole page instead of the content area, or lack a collapsed state.
What the source says
The shadcn/ui Sidebar docs (shadcn/ui is MIT) describe:
- Install with
pnpm dlx shadcn@latest add sidebar. - Parts:
SidebarProviderwraps the app and holds state;SidebarwithSidebarHeader,SidebarContent(scrolls),SidebarFooter; groups (SidebarGroup,SidebarGroupLabel), menus (SidebarMenu,SidebarMenuButton,SidebarMenuSub, badges, skeletons);SidebarRail;SidebarInsetfor the main area in theinsetvariant;SidebarTriggertoggles it. collapsiblemodes:offcanvas(default),icon(collapses to icons),none.sideis left or right;variantis sidebar, floating or inset.- Mobile: the
useSidebarhook exposesisMobile,openMobile,setOpenMobile; on mobile the sidebar is documented with a mobile width of 18rem (SIDEBAR_WIDTH_MOBILE) and the changelog explicitly shows a mobileSheetcontainingSheetContent. Keyboard shortcut: Cmd+B on Mac, Ctrl+B on Windows.
The shadcn Skills page/skills.mdx) says npx skills add shadcn/ui installs a skill that reads your components.json (framework, aliases, installed components, base library) and lists an example request, "Build a dashboard with a sidebar, stats cards, and a data table."
How to describe it to the agent
A prompt worth trying (mine, untried):
Build the app shell with the shadcn Sidebar: SidebarProvider at the layout, variant inset, collapsible icon. Nav groups: Workspace (Home, Projects, Inbox with a badge) and Settings. Active item follows the route. Footer has the user menu. On mobile it must open as a sheet from a trigger in the top bar. Main content scrolls, the sidebar does not. Do not invent your own sidebar markup.
Common mistakes to check
- A custom
<aside>next to the shadcn component. - Active state not tied to the router.
- Nested scrolling (page scrolls and content scrolls).
- Labels that disappear in icon mode with no tooltip. Ask for tooltips on collapsed items.
Limits
Cookie persistence of the open state was not in the page text I read, so I do not claim it.
Primary source
Primary source: shadcn/ui Sidebar docs (shadcn). Checked: install command, the sidebar parts, collapsible modes (offcanvas default, icon, none), side and variant values, useSidebar fields, and the Cmd+B / Ctrl+B shortcut. The Skills page example was re-verified on 2026-11-15.
Started from a post by @shadcn, packaged by the editor. Original post