{
  "purpose": "Compose labelled application navigation with a desktop expanded/collapsed state and an independently controlled mobile Sheet.",
  "avoid": "Collapsing must not remove access to essential destinations.",
  "classification": "source-bound-reference-with-explicit-decisions",
  "basis": "Pinned React/primitive sources lead API, lifecycle and semantics; native visual observations and explicit reference decisions are mapped in figma/traceability.json.",
  "profile": "interactive-control/1",
  "profileRationale": "The family presents controls or navigation; static depictions do not establish an interactive contract.",
  "componentId": "shadcn:Sidebar",
  "sourceRule": "All exported Sidebar parts are preserved. SidebarProvider defaults defaultOpen=true and supplies desktop open/state, openMobile, isMobile, setOpen/setOpenMobile and toggleSidebar through useSidebar; Sidebar itself accepts side left|right, variant sidebar|floating|inset and collapsible offcanvas|icon|none. Desktop widths are16rem, icon3rem, mobile18rem. The pinned use-mobile hook is false during SSR/initial render and tracks window.innerWidth<768 using matchMedia afterward. Desktop openProp and onOpenChange should be supplied as a pair: setOpen calls the handler instead of internal state whenever a handler exists, even without an openProp. The callback is boolean-only, not cancellable eventDetails. Every desktop setOpen request writes sidebar_state=true|false, path=/, max-age604800; the provider does not read that cookie automatically, and a rejected/ignored controlled request can still write its candidate. Mobile toggle only changes openMobile, with no desktop onOpenChange or cookie write. The two states are not synchronized/reset on breakpoint changes. collapsible=none bypasses responsive Sheet/collapse rendering even though provider state can still change. Trigger calls caller onClick then always toggles (defaultPrevented is not a veto); Rail is native button tabindex=-1 and needs explicit type=button in a form-safe reference. Provider always registers lowercase Ctrl/Meta+b globally while mounted, including editable targets; there is no disable-shortcut prop, so this reference uses one provider and documents that application constraint. SidebarInset is main; avoid nested main landmarks. Header/Footer/Group/Content are containers, Menu/Sub are native lists, and MenuButton defaults button via useRender: actual navigation deliberately renders anchors. isActive only supplies appearance/data-active, not aria-current; caller supplies current-page semantics. GroupLabel requires caller heading choice. Skeleton has random50–89% width and no loading announcement; use the completed Skeleton usage policy. Optional tooltip is visual-only and shown collapsed desktop, so native names remain complete. Mobile Sidebar composes Sheet with fixed title Sidebar/description Displays the mobile sidebar and hides its direct default Close button in source CSS; this reference supplies an explicit nested Close navigation control. Desktop icon collapse is chosen to keep intended navigation available; offcanvas CSS alone does not supply an inert/focus-removal guarantee.",
  "keyboardAndFocus": "Native Trigger Enter/Space and registered Ctrl/Meta+b toggle the appropriate viewport state. Desktop collapse does not become a dialog or trap focus. Mobile uses the real Sheet/Dialog focus, Escape and restoration policy; its trigger aria-expanded uses openMobile, not the desktop state. Navigation links retain native Tab/Enter and readable names when icon-collapsed. Rail is an optional pointer duplicate, not the sole keyboard access. Names, landmark label, heading and active-page relation are explicit caller composition.",
  "sourceCommit": "45bbf9ba23c9c0f63d38887947e5fb06f59c7da3",
  "sourceFiles": [
    "sources/shadcn/apps/v4/registry/bases/base/ui/sidebar.tsx.source",
    "sources/shadcn/apps/v4/content/docs/components/base/sidebar.mdx.source",
    "sources/shadcn/apps/v4/registry/bases/base/examples/sidebar-example.tsx.source",
    "sources/shadcn/apps/v4/registry/bases/base/hooks/use-mobile.ts.source"
  ],
  "primitiveDocs": [],
  "referenceDecision": "Concrete names, hrefs/current page, durable toast result, callback handling, desktop icon collapse and explicit mobile Close are caller composition. Native source code, exact defaults/limitations and independent primitive actors remain authoritative; no generic global selected state or extra public event is invented.",
  "visualContract": {
    "layoutPolicy": "SidebarProvider has a real wrapper and separate desktop/mobile state; useSidebar is context, not DOM. Desktop source widths 16rem/3rem are bound through the public style override to semantic tokens; native 255px inner+border and 48px collapsed examples remain evidence. Mobile uses source 18rem preferred Sheet width capped to viewport clearance; its data-slot is sidebar, so generic SheetContent slot rules alone do not style it. Source hardcoded hidden default Close is retained and target supplies a real visible SheetClose inside navigation content. Desktop physical left/right container, gap, icon/offcanvas state and mobile modal ownership remain distinct. Pinned Sidebar consumes dir but forwards it only to mobile SheetContent; the reference keeps the provider layout LTR for physical gap order and explicitly sets dir on Header/Content/Footer/Inset text regions. Right desktop inner border faces content. Native menu 8px corner role is retained;32/28/48 button sizes, group inset/captions, badges/actions/submenus and skeleton geometry are explicit bounded reference roles. Collapsed labels may be visually hidden only when each icon link has a persistent aria-label; optional Tooltip is supplementary, not sole naming. The reference composes Rail only on desktop; mobile has real Trigger/Close controls. Source Shortcut Ctrl/Meta+B still intercepts even editable descendants; preventDefault on SidebarTrigger callback does not cancel its subsequent internal toggle. Controlled desktop callback can be ignored while source cookie still records the requested state; no new cancellable event is invented. Mobile open state is independent, and the source 767px breakpoint is retained. Source variants/API stay in CEM/UX; no fixed native page height/position or source-id anatomy remains.",
    "parts": "component.json#/partBindings",
    "tokenBindings": "component.json#/visualContract/tokens",
    "sourceEvidence": "figma/traceability.json"
  }
}
