docs/solutions/developer-experience/2026-05-27-shadcn-docs-sidebar-parity-needs-source-and-dom-metrics.md
The docs shell was being adjusted from screenshots instead of using shadcn as the implementation source. That left small but visible mismatches in sidebar offset, item height, active state shape, page top spacing, and right-side TOC placement.
Sections and the first sidebar item did not line up with shadcn at the same viewport.w-fit menu buttons.--header-height at calc(var(--spacing) * 14) on large screens.../ui/apps/v4/components/docs-sidebar.tsx was close, but the deployed shadcn page used SidebarContent without mx-auto and with px-2.5.text-sm, font-medium, and pt-* values by eye.DocsNav structure and copying only individual classes.../ui file after browser metrics showed the deployed shadcn DOM differed in the sidebar content wrapper.Use shadcn's docs shell structure instead of custom nav markup:
SidebarProvider with the upstream grid and --sidebar-width.Sidebar, SidebarContent, SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuItem, and SidebarMenuButton.h-[30px] w-fit text-[0.8rem] font-medium with data-[active=true]:bg-accent.SidebarContent uses w-(--sidebar-menu-width) overflow-x-hidden px-2.5 without mx-auto.lg:[--header-height:calc(var(--spacing)*16)] to the body shell.Sections, first item, active item, h1, and TOC title coordinates.The sidebar is a composition of shadcn sidebar primitives, not just a list of links. Matching those primitives fixes the row width, active background, padding, scroll fades, border line, and label rhythm together.
Browser metrics catch the remaining drift that source reading can miss when local upstream source and deployed shadcn are not perfectly aligned.