Navigation
SideNav
Section navigation with collapsible groups; a column on large screens, a drawer below.
- Experimental
- Keyboard tested
- Screen reader not tested yet
Playground
Change the props. The controls come from the documented props.
<SideNav
label="Playground section"
current="#button"
groups={[
{
label: "Actions",
items: [{ label: "Button", href: "#button" }, { label: "Link", href: "#link" }],
},
]}
/>Usage
When to use
Use the side navigation for the pages within one section of a site, such as all components or all foundations.
When not to use
- For the main site navigation: use Nav.
- For a few subpages of one topic: use TabNav.
How it works
Collapsible groups with toggles that report their state. On large screens it is a column next to the content; below that it becomes a drawer behind a “Browse” button, with focus trapped inside and Esc to close. The current page is marked with aria-current.
Content guidelines
Group entries the way people look for them, not the way the code is organised. One level of groups at most.
Do and don’t
Do
- Group entries the way people look for them, not the way the code is organised.
Don’t
- Don't nest groups deeper than one level.
Anatomy
The parts of the component and what each one does, as in the playground above.
- groupCollapsible group with a toggle button.
- link14px link; the current page has a 2px accent line on the left.
- triggerBelow lg, opens the drawer.
- panelDrawer from the left with the same groups.
Examples
Type-checked, and the same code goes into the AI manifest. Import: import { SideNav } from "@/ds";
Two groups
Props
Checked against the component's TypeScript type on every build.
| Name | Type | Default | Description |
|---|---|---|---|
| label (required) | string | – | Accessible name, e.g. the section name. |
| groups (required) | SideNavGroup[] | – | Groups with a label and links. |
| current (required) | string | – | Path of the current page. |
| menuLabel | string | "Browse" | Label of the drawer button below lg. |
Tokens used
Derived from the utility classes in the component's source. Copy a class with one click.
| Token | Tier | Value | Utility |
|---|---|---|---|
| button.radius | component | 9999px | |
| dialog.backdrop | component | rgba(10,10,11,0.20) | |
| eyebrow.tracking | component | 0.18em | |
| sideNav.bg | component | #EFEDE6 | |
| sideNav.border | component | rgba(10,10,11,0.08) | |
| sideNav.groupFg | component | #555555 | |
| sideNav.link.bgCurrent | component | #FFFFFF | |
| sideNav.link.bgHover | component | #E7E3DA | |
| sideNav.link.fg | component | #555555 | |
| sideNav.link.fgCurrent | component | #0A0A0B | |
| sideNav.link.fgHover | component | #0A0A0B | |
| sideNav.link.indicator | component | #C6492E | |
| sideNav.link.radius | component | 8px | |
| focus | semantic | #C6492E | |
| spacing.0 | semantic | 0px | |
| spacing.1 | semantic | 4px | |
| spacing.2 | semantic | 8px | |
| spacing.3 | semantic | 12px | |
| spacing.4 | semantic | 16px | |
| spacing.6 | semantic | 24px | |
| surface.page | semantic | #FAFAF7 | |
| text.primary | semantic | #0A0A0B | |
| type.meta.size | semantic | 13px | |
| type.small.size | semantic | 14px | |
| weight.medium | semantic | 500 | |
| weight.semibold | semantic | 600 |
Accessibility
What is checked automatically on every build, and what a person has tested. Nothing is marked as tested unless it was.
| Check | How | Status |
|---|---|---|
| axe-core rules | Automated on every npm run check, at desktop and mobile width | Runs on every build |
| Keyboard | Automated Playwright test (scripts/keyboard.mjs) | Tested |
| Screen reader | Manual | Not tested yet |
Keyboard
| Key | Action |
|---|---|
| Tab | Moves through group toggles and links. |
| Enter / Space | Collapses or expands a group; opens the drawer. |
| Esc | Closes the drawer. |
Semantics and focus
- Named <nav>; current page aria-current="page", its parent aria-current="location".
- Group toggles with aria-expanded and aria-controls.
- Drawer is a React Aria modal: focus is trapped, Esc closes, focus returns to the trigger.
Contrast
| Pairing | Ratio (x:1) | Minimum | Status |
|---|---|---|---|
| text.primary on surface.page | 18.92 | 4.5 | Pass |
| text.primary on surface.card | 19.79 | 4.5 | Pass |
| text.secondary on surface.page | 7.13 | 4.5 | Pass |
| text.secondary on surface.card | 7.46 | 4.5 | Pass |
| accent.default on surface.page | 4.57 | 4.5 | Pass |
| accent.default on surface.card | 4.78 | 4.5 | Pass |
| focus on surface.page | 4.57 | 3.0 | Pass |
| focus on surface.card | 4.78 | 3.0 | Pass |
| text.primary on surface.subtle | 15.45 | 4.5 | Pass |
| text.primary on surface.sunken | 16.89 | 4.5 | Pass |
| text.secondary on surface.sunken | 6.36 | 4.5 | Pass |
| focus on surface.sunken | 4.08 | 3.0 | Pass |
| accent.default on surface.sunken | 4.08 | 3.0 | Pass |
| text.secondary on surface.subtle | 5.82 | 4.5 | Pass |