Aliases
sidebar navigation
components / sidenav
Two-level application shell navigation with active-state emphasis, branch expansion, and a collapsed mode.
Playground
Start here. Switch systems, interact with the shipped component, and let the rest of the page answer the why and how after the behavior clicks.
Cobalt
The crisp default DK action system: bright primary, roomy spacing, and a direct editorial rhythm.
Overview
This section explains the intent of the component before the implementation details.
Aliases
sidebar navigation
Explore the math
Decision guide
Use these notes to decide quickly whether this is the right DK component for the job.
Decision guide
Do
Do not
Usage
Prefer these situations when choosing this component.
Usage
These patterns are better served by a different component or a simpler surface.
Anti-patterns
Migration notes
Anatomy
The anatomy explains which pieces matter to the recipe and accessibility model.
nav row
itemSingle navigation destination or expandable parent.
expand/collapse affordance
branchToggles nested child visibility.
auxiliary status
badgeOptional compact count or state marker.
API
The docs contract distinguishes props, DOM events, and slots so integration behavior is explicit.
Props
| Name | Type | Default | Description |
|---|---|---|---|
items | Array<{ id: string; label: string; href?: string; icon?: string; badge?: string; disabled?: boolean; children?: SideNavItem[] }> | — | Navigation tree with at most two visible levels in the current contract. |
activeId | string | — | Controlled active navigation id. |
collapsed | boolean | false | Enables the denser collapsed shell mode. |
onChange | (detail: { id: string }) => void | — | Callback fired when the active navigation item changes. |
theme | ThemeContract | — | Overrides the compiled DK theme used to resolve tokens and recipes for this component. |
Events
| Name | Payload | Description |
|---|---|---|
change | { id: string } | Fires when the active item changes. |
Slots
| Name | Description |
|---|---|
default | SideNav is data-driven in v1 and does not expose item slots. |
Recipes
These notes summarize the intended recipe surface rather than exposing raw implementation detail first.
Variants
Sizes
States
Accessibility
This is the behavior the component promises to assistive tech and keyboard users today.
Semantics
Keyboard
Screen readers
Checklist
Implementation
This section shows the representative compiled slot variables that the runtime consumes for the selected design system.
Implementation notes
Implementation checklist
Examples
Each example is intentionally practical, grouped by starter, common pattern, and edge-case coverage.
Starter
1 example
starter
Starter: app shell navigationA persistent shell navigation with one expanded branch.
Copy snippet
<SideNav items={navItems} activeId="overview" onChange={(detail) => activeId = detail.id} />Common patterns
1 example
common
Common: collapsed shell modeCollapsed mode keeps the app shell lighter while preserving the active section marker.
Copy snippet
<SideNav items={navItems} activeId="overview" collapsed={true} />Edge cases
1 example
edge
Edge: navigation with countsBadges can call attention to queues or inbox-like sections without changing the base navigation contract.
Copy snippet
<SideNav items={[{ id: 'inbox', label: 'Inbox', badge: '12' }, { id: 'releases', label: 'Releases', children: [{ id: 'planned', label: 'Planned' }] }]} activeId="inbox" />Verification
Proofs stay visible in the docs so the system shows what it can guarantee, not just what it can render.