Skip to main content

An official website of the United States government

Here's how you know

An official website of the United States government

Here's how you know

Theme:

Design system switcher

Version:

Design system switcher

Theme:

Design system switcher

Version:

Design system switcher

Vertical Navigation

Hierarchical, vertical navigation.

Examples

Loading

Code

React

See Storybook "Vertical Nav" page for React documentation.

Style customization

The following CSS variables can be overridden to customize VerticalNav components:

CSS variables for vertical-nav
VariableDefault Core Theme Value
--vertical-nav-item__background-color--hoverhex value: #f2f2f2--color-gray-lightest
--vertical-nav-item__color--hoverhex value: #0071bc--color-primary
--vertical-nav-item__border-colorhex value: #5a5a5a--color-gray-dark
--vertical-nav-label__colorhex value: #262626--color-base
--vertical-nav-label-icon__colorhex value: #262626--color-base
--vertical-nav-label__border-color--currenthex value: #0071bc--color-primary
--vertical-nav-label__color--currenthex value: #0071bc--color-primary

Guidance

When to use

  • To display a navigational hierarchy with one to three levels.
  • To display the “sub-navigation” within a section of the website.

When to consider alternatives

  • If the site has fewer than five pages, consider organizing the page without a navigational hierarchy.
  • If your page already has a horizontal and vertical navigation bar, consider ways to simplify your navigation system.
  • If your content is within a frame or sub-area of a page, consider ways to simplify your navigation system.

Usage

  • Indicate where a user is within the navigational hierarchy. Use the .ds-c-vertical-nav__label--current modifier to show users which page they have navigated to.
  • Keep the navigation links short and follow sentence case. They can be shorter derivatives of page titles themselves.
  • If the navigation hierarchy is too long, users may miss items at the bottom. If it’s too deep, users may miss items that require too many clicks. Usability test to find the right balance between breadth and depth.

Accessibility

  • Users should be able to tab through each link.
  • If you have nested menus that are collapsible, ensure the toggle button has its aria-controls and aria-expanded attributes set. This is done automatically for you if you're using the React components.
  • If your navigation list is longer than 3 items, consider using a skip navigation link. This allows screen reader and keyboard users to skip to the main content area(s).
  • If a skip navigation link is not an option, consider using:
    • A valid, descriptive page header
    • Landmark regions like <header>, <main>, <aside>, <footer>
  • When naming the optional ariaNavLabel prop, keep in mind:
    • This prop is necessary only when there is more than one nav element on a page.
    • Don't include the word "Menu" in the label. Most screen readers will announce that information already. Instead, provide more context to what's in the menu and/or its location. Like "Main" or "Social".

Learn more

Component maturity

This component meets 89% of our maturity criteria.

Incomplete criteria

  • Incomplete

    Forced Colors Mode (FCM): While using FCM the components text is legible and improves readability.

What does this mean?

Each component is tested against the following items to gauge the component's maturity. When using incomplete components, consider the unmet criteria as applied to your product.

For more information about how we tested and validated our work for each checklist item, read our component maturity documentation.