Skip to content

Search

Start typing to search.


Show all pages

Documentation

navigation

Navbar

The bar at the top of a site or app with the brand, the main links and a few actions.

Native behaviorUses built-in HTML behavior, so you write no script.

Usage

The links sit in a [popover] menu. At 40rem and wider they show in the bar; narrower, the menu button opens them. Resize the window to see both.

HTML

Examples

Guidance and accessibility

When to use

  • Use one navbar at the top of a site or app for the few places people go most.
  • Keep the main links to about five. More belong in a sidebar or a menu.
  • Keep actions short; on narrow screens they stay in the bar next to the menu button. A bar with several actions, such as the header of this site, uses ca-navbar--roomy, so the links fold away before they run out of room.

Accessibility

  • Put the menu in a <nav> with an aria-label, such as “Main”, so it is listed as a landmark.
  • The menu button needs a name, such as aria-label="Menu". Browsers tell screen readers whether the menu is open.
  • When narrow, the menu is a native popover: Escape and a click outside close it and focus returns to the button.
  • Mark the current page with aria-current="page".

Classes

Generated from the component contract. Parts use __, modifiers use --.

Classes of the navbar component
ClassKindUse it for
ca-navbarComponentThe bar; a size container, so it adapts to its own width, not the window's.
ca-navbar__brandPartLink to the home page with the name or logo.
ca-navbar__menuPartThe [popover] with the main links; in the bar when wide, a panel when narrow.
ca-navbar__linkPartOne main link. Mark the current page with aria-current="page".
ca-navbar__actionsPartButtons at the end of the bar, such as the main action or an account menu.
ca-navbar__togglePartThe menu button that opens the links when the bar is narrow.
ca-navbar--roomyLayoutFor a bar with more actions; the links move into the menu below 64rem instead of 40rem.

Skins

The same markup, dressed by each skin. Structure and behavior stay the same; only the look changes.

Base skin

Neutral grayscale starting point; product skins extend it and change what differs.

Calaca skin

The Calaca UI brand: hueso paper and tinta ink, cempasúchil marigold, rosa and jade.

Proof skin

Pilot skin pushed far from base: square, heavy, offset shadows, larger targets.

Crossview skin

The CrossView proofing table: cool ground, bond-paper sheets, rule-grey hairlines, one red mark.

Framework notes

Link the prebuilt stylesheet of your skin next to your brand theme. No build step.

HTML
<link rel="stylesheet" href="theme.css" />
<link rel="stylesheet" href="ca-base.css" />