Skip to content
Style Guide
v0.1.0

Components

Navigation

Primary bars, sidebars, breadcrumbs and tabs. The current location is marked with a 2px rule in the interactive colour and a heavier weight — never with colour alone.

Primary navigation

A horizontal bar below the masthead, for up to about six destinations. The current page is marked three ways at once: a 2px rule on the block-end edge, a heavier font weight, and aria-current="page".

Primary navigation
aria-current="page" is not optional. The underline and the weight change are invisible to a screen reader user; this attribute is the only thing that tells them where they are. It also drives the styling, so there is one source of truth.

On small screens

Below 960px a sidebar becomes a drawer behind a toggle button. The rules that keep it usable:

  • The toggle is a real <button> with aria-expanded and aria-controls pointing at the nav's id.
  • Escape closes it, and so does clicking the scrim behind it.
  • The drawer slides from the inline-start edge, so it comes from the right in Arabic.
  • Focus moves into the drawer when it opens and returns to the toggle when it closes.

A horizontal primary bar can simply wrap onto two lines on narrow screens — that is usually better than hiding four links behind a menu.

Tabs

Tabs switch between panels of the same page. They are not navigation — if the content lives at a different URL, use links, not tabs.

Tabs
Tabs need JavaScript to be correct. Only the selected tab is in the tab order (tabindex="-1" on the others); the arrow keys move between tabs, and Home and End jump to the first and last. In Arabic the arrow keys reverse with the visual order. The CSS gives you the appearance — the behaviour is yours to implement.

In Arabic

Navigation is where right-to-left problems show up first, because it is full of edges and arrows.

  • Order is unchanged in the markup. The browser reverses the visual order; the DOM order stays the tab order.
  • The sidebar's active marker and the drawer both follow the inline-start edge, so they move to the right automatically.
  • A chevron indicating "deeper" must be mirrored. A chevron indicating "expand downward" must not.
  • Check it with the RTL toggle on each example above before you ship.

Do and don't

Do

  • Give every <nav> an aria-label when there is more than one on the page.
  • Mark the current page with aria-current="page".
  • Keep labels to one or two words, in sentence case.
  • Keep the order identical across the product.

Don't

  • Hide primary destinations behind a menu on desktop.
  • Use tabs for things that are really separate pages.
  • Rely on the underline alone to show the current page.
  • Nest more than two levels — that is a sign the information architecture needs work.