Skip to main content

Navigation menu

Site navigation with links and panels.

Left out of Dense data Navigation menu is for the sections of a website. Dense data avoids public sites, and its app navigation stays open all shift in a sidebar. Use instead: Sidebar, Tabs

See it live​

Start Storybook to see it live: npm run storybook

When to use it​

  • 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:

  • Sidebar: App navigation that stays open.
  • Tabs: Views of one thing.

Words​

  • Lead with the object, then the state: "Alert 2041 contained."
  • Use numbers, not words for numbers.
  • One verb per button. No "please", no exclamation marks.
  • Use: Investigate, Filter, Assign, Escalated, Resolved. Avoid: Oops, Awesome, Please, Simply.

The labels components use, from the voice tokens:

  • content.action.commit: Save
  • content.action.cancel: Cancel
  • content.action.destroy: Delete
  • content.action.retry: Retry
  • content.action.empty-action: Change filters

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.

Changes with theme

Dense data 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.

PartIts token and the semantic it aliasesValue
Shared
Transition panels durationcomponent.transition.panels-durationmotion.duration.panelsvar(--transition-panels-duration)duration.fast:120ms
List
Gapcomponent.navigation-menu.list.gapspace.gap.tightvar(--navigation-menu-list-gap)space.4:0.25rem
Navigation menu
Cornercomponent.navigation-menu.radiusradius.controlvar(--navigation-menu-radius)radius.2:0.125rem
Fill
Changes with theme
component.navigation-menu.backgroundcolor.surface.canvasvar(--navigation-menu-background)Lightslate.light.50:#F7F8FADarkslate.dark.0:#0D1117
Padding, left and rightcomponent.navigation-menu.padding-xspace.inset.containervar(--navigation-menu-padding-x)space.16:1rem
Padding, top and bottomcomponent.navigation-menu.padding-ycomponent-spacing-map.x2var(--navigation-menu-padding-y)space.8:0.5rem
Text sizecomponent.navigation-menu.font-sizetype.body.font-sizevar(--navigation-menu-font-size)font.size.14:0.875rem
Weightcomponent.navigation-menu.font-weighttype.label.font-weightvar(--navigation-menu-font-weight)font.weight.500:500
Background hover
Changes with theme
on hover
component.navigation-menu.background-hovercolor.surface.sunkenvar(--navigation-menu-background-hover)Lightslate.light.100:#EEF1F5Darkslate.dark.100:#262D38
Label hover
Changes with theme
on hover
component.navigation-menu.label-hovercolor.text.primaryvar(--navigation-menu-label-hover)Lightslate.light.900:#161B23Darkslate.dark.900:#F7F8FA
Background focus
Changes with theme
on focus
component.navigation-menu.background-focuscolor.surface.sunkenvar(--navigation-menu-background-focus)Lightslate.light.100:#EEF1F5Darkslate.dark.100:#262D38
Label focus
Changes with theme
on focus
component.navigation-menu.label-focuscolor.text.primaryvar(--navigation-menu-label-focus)Lightslate.light.900:#161B23Darkslate.dark.900:#F7F8FA
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)Lightslate.light.100:#EEF1F5Darkslate.dark.100:#262D38
Label open
Changes with theme
when open
component.navigation-menu.label-opencolor.text.primaryvar(--navigation-menu-label-open)Lightslate.light.900:#161B23Darkslate.dark.900:#F7F8FA
Background open hover
Changes with theme
when open, on hover
component.navigation-menu.background-open-hovercolor.surface.sunkenvar(--navigation-menu-background-open-hover)Lightslate.light.100:#EEF1F5Darkslate.dark.100:#262D38
Background open focus
Changes with theme
when open, on focus
component.navigation-menu.background-open-focuscolor.surface.sunkenvar(--navigation-menu-background-open-focus)Lightslate.light.100:#EEF1F5Darkslate.dark.100:#262D38
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)Lightviolet.light.600:#4B3FD9Darkviolet.dark.600:#A9A3F6
Focus ring offset focus
Changes with theme
on focus
component.navigation-menu.focus-ring-offset-focuscolor.surface.canvasvar(--navigation-menu-focus-ring-offset-focus)Lightslate.light.50:#F7F8FADarkslate.dark.0:#0D1117
Speedcomponent.navigation-menu.durationmotion.duration.feedbackvar(--navigation-menu-duration)duration.fast:120ms
Background 2
Changes with theme
component.navigation-menu.background-2color.surface.raisedvar(--navigation-menu-background-2)Lightslate.light.0:#FFFFFFDarkslate.dark.100:#262D38
Text
Changes with theme
component.navigation-menu.labelcolor.text.primaryvar(--navigation-menu-label)Lightslate.light.900:#161B23Darkslate.dark.900:#F7F8FA
Shadowcomponent.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)Lightslate.light.200:#DDE2EADarkslate.dark.100:#262D38
Shadow 2
Changes with theme
component.navigation-menu.shadow-2elevation.overlayvar(--navigation-menu-shadow-2)Lightshadow.overlay:0px 8px 24px 0px #0D111729Darkshadow.overlay-dark:0px 8px 24px 0px #00000080
Content
Paddingcomponent.navigation-menu.content.paddingcomponent-spacing-map.x2var(--navigation-menu-content-padding)space.8:0.5rem
Padding rightcomponent.navigation-menu.content.padding-rightcomponent-spacing-map.x3var(--navigation-menu-content-padding-right)space.12:0.75rem
Viewport
Cornercomponent.navigation-menu.viewport.radiusradius.controlvar(--navigation-menu-viewport-radius)radius.2:0.125rem
Fill
Changes with theme
component.navigation-menu.viewport.backgroundcolor.surface.raisedvar(--navigation-menu-viewport-background)Lightslate.light.0:#FFFFFFDarkslate.dark.100:#262D38
Text
Changes with theme
component.navigation-menu.viewport.labelcolor.text.primaryvar(--navigation-menu-viewport-label)Lightslate.light.900:#161B23Darkslate.dark.900:#F7F8FA
Shadowcomponent.navigation-menu.viewport.shadowelevation.cardvar(--navigation-menu-viewport-shadow)shadow.none
Link
Gapcomponent.navigation-menu.link.gapspace.gap.tightvar(--navigation-menu-link-gap)space.4:0.25rem
Cornercomponent.navigation-menu.link.radiusradius.badgevar(--navigation-menu-link-radius)radius.0:0rem
Paddingcomponent.navigation-menu.link.paddingcomponent-spacing-map.x2var(--navigation-menu-link-padding)space.8:0.5rem
Text sizecomponent.navigation-menu.link.font-sizetype.body.font-sizevar(--navigation-menu-link-font-size)font.size.14:0.875rem
Background hover
Changes with theme
on hover
component.navigation-menu.link.background-hovercolor.surface.sunkenvar(--navigation-menu-link-background-hover)Lightslate.light.100:#EEF1F5Darkslate.dark.100:#262D38
Label hover
Changes with theme
on hover
component.navigation-menu.link.label-hovercolor.text.primaryvar(--navigation-menu-link-label-hover)Lightslate.light.900:#161B23Darkslate.dark.900:#F7F8FA
Background focus
Changes with theme
on focus
component.navigation-menu.link.background-focuscolor.surface.sunkenvar(--navigation-menu-link-background-focus)Lightslate.light.100:#EEF1F5Darkslate.dark.100:#262D38
Label focus
Changes with theme
on focus
component.navigation-menu.link.label-focuscolor.text.primaryvar(--navigation-menu-link-label-focus)Lightslate.light.900:#161B23Darkslate.dark.900:#F7F8FA
Fill
Changes with theme
component.navigation-menu.link.backgroundcolor.surface.sunkenvar(--navigation-menu-link-background)Lightslate.light.100:#EEF1F5Darkslate.dark.100:#262D38
Focuscomponent.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)Lightslate.light.900:#161B23Darkslate.dark.900:#F7F8FA
Icon sizecomponent.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)Lightslate.light.600:#535D6DDarkslate.dark.400:#969FAD
Focus ring focus
Changes with theme
on focus
component.navigation-menu.link.focus-ring-focuscolor.border.focusvar(--navigation-menu-link-focus-ring-focus)Lightviolet.light.600:#4B3FD9Darkviolet.dark.600:#A9A3F6
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)Lightslate.light.50:#F7F8FADarkslate.dark.0:#0D1117
From the system
Edge
Changes with theme
color.border.default
straight from the system, through --border
Lightslate.light.200 · #DDE2EADarkslate.dark.100 · #262D38
Cornerradius.badge
straight from the system, through --radius-sm
radius.0 · 0rem (0px)