Navigation menu
Site navigation with links and panels.
In Content first
See it live
npm run storybookWhen to use it
In Content first: The site sections.
- Use it when: The main sections of a website, sometimes with a panel of sub-links.
- Not when: App navigation that stays open (sidebar), or actions (dropdown menu).
Instead:
Words
- Write to one person: "you", not "users".
- Short sentences with room to breathe.
- Explain why before asking for anything.
- Use: Read, Save for later, You, Next issue. Avoid: Click here, Submit, Users, Content.
The labels components use, from the voice tokens:
content.action.commit: Savecontent.action.cancel: Not nowcontent.action.destroy: Removecontent.action.retry: Try againcontent.action.empty-action: Browse guides
See Voice and tone for the whole voice.
Accessibility and keyboard
Test before you ship:
- It is a navigation landmark; the current page is marked. undefined
Use it in code
npx open-ds add navigation-menu
The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.
Tokens it reads
Navigation menu reads 47 tokens of its own, each an alias of a semantic token. Each row is one part: its own token, the semantic it aliases, and the value it ends at. Change a semantic and every component that reads it follows; override one of Navigation menu's tokens to change Navigation menu alone.
Content first decides what changes when you switch theme. Here a switch changes colors only, so the marked rows differ between light and dark; everything else holds steady.
| Part | Its token and the semantic it aliases | Value |
|---|---|---|
| Shared | ||
| Transition panels duration | component.transition.panels-durationmotion.duration.panelsvar(--transition-panels-duration) | duration.relaxed:320ms |
| List | ||
| Gap | component.navigation-menu.list.gapspace.gap.tightvar(--navigation-menu-list-gap) | space.8:0.5rem |
| Navigation menu | ||
| Corner | component.navigation-menu.radiusradius.controlvar(--navigation-menu-radius) | radius.8:0.5rem |
| Fill Changes with theme | component.navigation-menu.backgroundcolor.surface.canvasvar(--navigation-menu-background) | Lightstone.light.50:#FFFDF8Darkstone.dark.0:#14110D |
| Padding, left and right | component.navigation-menu.padding-xspace.inset.containervar(--navigation-menu-padding-x) | space.24:1.5rem |
| Padding, top and bottom | component.navigation-menu.padding-ycomponent-spacing-map.x2var(--navigation-menu-padding-y) | space.8:0.5rem |
| Text size | component.navigation-menu.font-sizetype.body.font-sizevar(--navigation-menu-font-size) | font.size.18:1.125rem |
| Weight | component.navigation-menu.font-weighttype.label.font-weightvar(--navigation-menu-font-weight) | font.weight.600:600 |
| Background hover Changes with theme on hover | component.navigation-menu.background-hovercolor.surface.sunkenvar(--navigation-menu-background-hover) | Lightstone.light.100:#F6F2EADarkstone.dark.100:#2E2A24 |
| Label hover Changes with theme on hover | component.navigation-menu.label-hovercolor.text.primaryvar(--navigation-menu-label-hover) | Lightstone.light.900:#1F1B16Darkstone.dark.900:#FFFDF8 |
| Background focus Changes with theme on focus | component.navigation-menu.background-focuscolor.surface.sunkenvar(--navigation-menu-background-focus) | Lightstone.light.100:#F6F2EADarkstone.dark.100:#2E2A24 |
| Label focus Changes with theme on focus | component.navigation-menu.label-focuscolor.text.primaryvar(--navigation-menu-label-focus) | Lightstone.light.900:#1F1B16Darkstone.dark.900:#FFFDF8 |
| Disabled opacity disabled when disabled | component.navigation-menu.disabled-opacity-disabledopacity.disabledvar(--navigation-menu-disabled-opacity-disabled) | opacity.40:0.4 |
| Background open Changes with theme when open | component.navigation-menu.background-opencolor.surface.sunkenvar(--navigation-menu-background-open) | Lightstone.light.100:#F6F2EADarkstone.dark.100:#2E2A24 |
| Label open Changes with theme when open | component.navigation-menu.label-opencolor.text.primaryvar(--navigation-menu-label-open) | Lightstone.light.900:#1F1B16Darkstone.dark.900:#FFFDF8 |
| Background open hover Changes with theme when open, on hover | component.navigation-menu.background-open-hovercolor.surface.sunkenvar(--navigation-menu-background-open-hover) | Lightstone.light.100:#F6F2EADarkstone.dark.100:#2E2A24 |
| Background open focus Changes with theme when open, on focus | component.navigation-menu.background-open-focuscolor.surface.sunkenvar(--navigation-menu-background-open-focus) | Lightstone.light.100:#F6F2EADarkstone.dark.100:#2E2A24 |
| Focus on focus | component.navigation-menu.focusborder-width.focusvar(--navigation-menu-focus) | border-width.2:2px |
| Focus ring focus Changes with theme on focus | component.navigation-menu.focus-ring-focuscolor.border.focusvar(--navigation-menu-focus-ring-focus) | Lightnavy.light.600:#1E3A5FDarknavy.dark.600:#8FA6C4 |
| Focus ring offset focus Changes with theme on focus | component.navigation-menu.focus-ring-offset-focuscolor.surface.canvasvar(--navigation-menu-focus-ring-offset-focus) | Lightstone.light.50:#FFFDF8Darkstone.dark.0:#14110D |
| Speed | component.navigation-menu.durationmotion.duration.feedbackvar(--navigation-menu-duration) | duration.moderate:200ms |
| Background 2 Changes with theme | component.navigation-menu.background-2color.surface.raisedvar(--navigation-menu-background-2) | Lightstone.light.0:#FFFFFFDarkstone.dark.100:#2E2A24 |
| Text Changes with theme | component.navigation-menu.labelcolor.text.primaryvar(--navigation-menu-label) | Lightstone.light.900:#1F1B16Darkstone.dark.900:#FFFDF8 |
| Shadow | component.navigation-menu.shadowelevation.cardvar(--navigation-menu-shadow) | shadow.none |
| Background 3 Changes with theme | component.navigation-menu.background-3color.border.defaultvar(--navigation-menu-background-3) | Lightstone.light.200:#E4DDD0Darkstone.dark.100:#2E2A24 |
| Shadow 2 Changes with theme | component.navigation-menu.shadow-2elevation.overlayvar(--navigation-menu-shadow-2) | Lightshadow.overlay:0px 12px 32px 0px #1F1B1629Darkshadow.overlay-dark:0px 12px 32px 0px #00000080 |
| Content | ||
| Padding | component.navigation-menu.content.paddingcomponent-spacing-map.x2var(--navigation-menu-content-padding) | space.8:0.5rem |
| Padding right | component.navigation-menu.content.padding-rightcomponent-spacing-map.x3var(--navigation-menu-content-padding-right) | space.20:1.25rem |
| Viewport | ||
| Corner | component.navigation-menu.viewport.radiusradius.controlvar(--navigation-menu-viewport-radius) | radius.8:0.5rem |
| Fill Changes with theme | component.navigation-menu.viewport.backgroundcolor.surface.raisedvar(--navigation-menu-viewport-background) | Lightstone.light.0:#FFFFFFDarkstone.dark.100:#2E2A24 |
| Text Changes with theme | component.navigation-menu.viewport.labelcolor.text.primaryvar(--navigation-menu-viewport-label) | Lightstone.light.900:#1F1B16Darkstone.dark.900:#FFFDF8 |
| Shadow | component.navigation-menu.viewport.shadowelevation.cardvar(--navigation-menu-viewport-shadow) | shadow.none |
| Link | ||
| Gap | component.navigation-menu.link.gapspace.gap.tightvar(--navigation-menu-link-gap) | space.8:0.5rem |
| Corner | component.navigation-menu.link.radiusradius.badgevar(--navigation-menu-link-radius) | radius.999:9999px |
| Padding | component.navigation-menu.link.paddingcomponent-spacing-map.x2var(--navigation-menu-link-padding) | space.8:0.5rem |
| Text size | component.navigation-menu.link.font-sizetype.body.font-sizevar(--navigation-menu-link-font-size) | font.size.18:1.125rem |
| Background hover Changes with theme on hover | component.navigation-menu.link.background-hovercolor.surface.sunkenvar(--navigation-menu-link-background-hover) | Lightstone.light.100:#F6F2EADarkstone.dark.100:#2E2A24 |
| Label hover Changes with theme on hover | component.navigation-menu.link.label-hovercolor.text.primaryvar(--navigation-menu-link-label-hover) | Lightstone.light.900:#1F1B16Darkstone.dark.900:#FFFDF8 |
| Background focus Changes with theme on focus | component.navigation-menu.link.background-focuscolor.surface.sunkenvar(--navigation-menu-link-background-focus) | Lightstone.light.100:#F6F2EADarkstone.dark.100:#2E2A24 |
| Label focus Changes with theme on focus | component.navigation-menu.link.label-focuscolor.text.primaryvar(--navigation-menu-link-label-focus) | Lightstone.light.900:#1F1B16Darkstone.dark.900:#FFFDF8 |
| Fill Changes with theme | component.navigation-menu.link.backgroundcolor.surface.sunkenvar(--navigation-menu-link-background) | Lightstone.light.100:#F6F2EADarkstone.dark.100:#2E2A24 |
| Focus | component.navigation-menu.link.focusborder-width.focusvar(--navigation-menu-link-focus) | border-width.2:2px |
| Text Changes with theme | component.navigation-menu.link.labelcolor.text.primaryvar(--navigation-menu-link-label) | Lightstone.light.900:#1F1B16Darkstone.dark.900:#FFFDF8 |
| Icon size | component.navigation-menu.link.icon-sizesize.iconvar(--navigation-menu-link-icon-size) | size.16:1rem |
| Label 2 Changes with theme | component.navigation-menu.link.label-2color.text.mutedvar(--navigation-menu-link-label-2) | Lightstone.light.600:#61594DDarkstone.dark.400:#A39A8B |
| Focus ring focus Changes with theme on focus | component.navigation-menu.link.focus-ring-focuscolor.border.focusvar(--navigation-menu-link-focus-ring-focus) | Lightnavy.light.600:#1E3A5FDarknavy.dark.600:#8FA6C4 |
| Focus ring offset focus Changes with theme on focus | component.navigation-menu.link.focus-ring-offset-focuscolor.surface.canvasvar(--navigation-menu-link-focus-ring-offset-focus) | Lightstone.light.50:#FFFDF8Darkstone.dark.0:#14110D |
| From the system | ||
| Edge Changes with theme | color.border.default straight from the system, through --border | Lightstone.light.200 · #E4DDD0Darkstone.dark.100 · #2E2A24 |
| Corner | radius.badge straight from the system, through --radius-sm | radius.999 · 9999px |