Global navigation bar
Usage
The top nav is the app header on every Fleetline screen: product logo (home), the 4–6 main areas, search, notifications and the profile menu. Use the side nav for the second level inside an area (e.g. the workshop sections).
- Link labels are short nouns for places: "Dispatch", "Work orders". Don't put actions ("New work order") in the nav — they go in the page header.
- The current area is marked with
aria-current="page"plus weight and a bar. - Notification counts go in the name ("Notifications, 3 unread").
- Sticky variant: set
html { scroll-padding-top }to the bar height so focused elements aren't hidden under it. - The layout reacts to its own width (container query at 48rem), so it also collapses in narrow split views on desktop.
Anatomy
- Menu toggle —
.top-nav__toggle(narrow only) - Brand —
a.top-nav__brandto the home dashboard - Main nav —
nav.top-nav__nav[aria-label=Main]with.top-nav__linkitems - Search —
form.top-nav__search[role=search] - Actions — notifications
.icon-btnand the profile menu button
Examples
Resize the window, or compare the narrow demos, to see the collapsed layout. States marked hover, focus-visible and active are frozen with .is-hover, .is-focus-visible, .is-active. Those classes share their rule with the real pseudo-class, so what you see is exactly what users get. Never use them in product code.
API
| Hook | Values | Purpose |
|---|---|---|
.top-nav | block class | App header; inline-size container named top-nav |
.top-nav--sticky | modifier | Sticks to the top (--z-sticky) |
.top-nav__bar | __brand | __logo | __panel | __nav | __list | __link | __search | __search-input | __search-icon | __actions | __avatar | parts | See anatomy |
.top-nav__toggle[aria-controls] | part | Menu button; js/top-nav.js adds and toggles aria-expanded |
aria-current="page" | attribute | Current area |
Do and don't
"Dispatch · Vehicles · Work orders · Depots · Reports"
"Home · Fleet · New WO · Settings · Help · Billing · Reports · More"
Accessibility
| Key | Behavior |
|---|---|
| Tab | Moves through Menu (narrow), brand, links, search, notifications, profile |
| Enter / Space (Menu) | Opens / closes the panel |
| Esc | Closes the open panel and returns focus to Menu |
- Landmarks:
<header>is the banner at page level; the links are in<nav aria-label="Main">; search isrole="search"with a real (visually hidden) label. - Without JavaScript the Menu button stays hidden and the panel is open, so navigation always works.
- Mobile links are 44px tall (
--size-touch-target). - Forced colors: the current link adds an underline because box-shadow bars disappear.
Tokens
| Custom property | Purpose |
|---|---|
--color-bg-surface, --color-border-default | Bar |
--color-text-muted | -default | Link rest / hover and current |
--color-selected-border | -bg | -fg | Current bar (and mobile current fill) |
--input-bg | -border | -radius | Search field |
--size-control-md | -lg, --size-touch-target | Heights |
--z-sticky | Sticky variant |