Skip to content

Navigation bar

Expressive

3–5 destinations along the bottom of compact and medium windows, stacked or inline.

import { NavigationBar, NavigationBarItem } from '@windmorph/react';

Keyboard

Navigation bar keyboard
KeyAction
TabMoves focus to each item in turn, and on past the bar.
Arrow Left or Arrow RightMoves focus to the previous or next item, wrapping, without choosing it.
Home or EndMoves focus to the first or last item.
EnterOpens the focused destination. On a button item Space does the same.
  • The arrow keys skip disabled items and are mirrored right to left.
  • Pressing the current destination again calls onReselect, where the page can scroll back to the top.

Screen reader

Role
A navigation landmark (nav); each item is a link (href) or a button.
Accessible name
The bar is named by aria-label or aria-labelledby, which the types require. Each item is named by its label.
States announced
The current destination has aria-current="page". A disabled item is announced as disabled.
  • Icons, the active indicator and the state layer are hidden from assistive tech (aria-hidden).
  • A badge describes its item (aria-describedby), read after the name: its text, its label, or badgeLabel ("3 new messages"). A small (dot) badge reads "New notification".

Focus

  • The items are in the Tab order in their visual order. A disabled item can't be focused.
  • Keyboard focus shows M3's focus indicator, a 3px secondary outline 2px outside the pill. Pointer presses show no ring.
  • A bar fully hidden by hide-on-scroll is inert: Tab skips its items and screen readers leave them out until it comes back.
  • While keyboard focus is on one of its items the bar stays on screen as the page scrolls, and focusing a partly hidden bar brings it back, so a focused item is never hidden (WCAG 2.4.11).

Touch target

  • Every item stretches to the bar's height, 64px or more when a label wraps, so the whole item is the touch target, not only the pill.
  • Stacked items share the bar's width (or are at least the 56px pill wide when centred); items with the icon beside the label are at least 56px wide.

Motion

  • Under reduced motion the active indicator fades in whole instead of expanding from the icon's centre, and the press ripple appears at full size without growing. Colours still fade.
  • With scrollBehavior="hide-on-scroll", the bar stays put under reduced motion.

What you need to do

  • Name the bar with aria-label or aria-labelledby, distinct from other navigation on the page.
  • Give every item a short visible label. Labels wrap between words, so keep the full text; only a single word too wide for its item at large text sizes ends with an ellipsis.
  • Mark the current destination with current, and give it a filled currentIcon where the icon set has one, so the state does not rest on colour alone.
  • Leave hide-on-scroll off where a screen reader is in use, as M3 asks; the bar can't detect one.
  • Scroll the page to the top in onReselect, as M3 asks.