Skip to main content
Design system

Navigation Menu

A group of text links used for navigating between related pages or individual sections within a page.

Bundle size: 66.55 kB
Install:
npm install @washingtonpost/wpds-ui-kit
|Copy
Usage:
import { NavigationMenu } from "@washingtonpost/wpds-ui-kit"
|Copy
Storybook:  View on Storybook
Source:  View on Github
Primitive:  View their docs

Anatomy

Note: Image not to scale

  1. Menu link (text label / trigger)
  2. Submenu indicator
  3. Active state (bold)

Options

Orientation

Navigation menu supports both horizontal and vertical layout orientations. In horizontal orientation, menu links are baseline-aligned, ordered from left to right. In vertical orientation, menu links are left-aligned, ordered from top to bottom.

Navigation menu supports one level of sub-navigation.


Behavior

Hover

Menu links change color to $accessible on hover. Submenu links display background color $faint on hover.

Active

Any menu link can be set to active` to indicate the page or section currently in view. Active links are rendered in font-weight bold.

Disabled

A menu (or submenu) link can be set to disabled, according to the user’s current context and relevance of options.

Overflow

For submenus containing a large number of links, define a max-height and set the container to scroll to allow users to access additional items.


Guidance

For primary navigation, the maximum number of menu links recommended is eight (8). If your use case requires more than 8 menu links, re-evaluate your navigation hierarchy to make use of submenus, or consider using a different component.


Accessibility

When navigation menu is in focus, links can be traversed using left, right, up and down arrow keys, or tab / shift+tab. Pressing the enter key executes a click function, which will navigate the user to the selected link. Links containing a submenu can be accessed by focusing the link and pressing space bar to toggle display of the submenu. Pressing the esc key exits the submenu and moves focus back to the parent link / trigger.


API Reference

Edit this page on GitHub.