Sidebar navigation
Usage
Use the side nav for the pages inside one area of Fleetline when there are more than five (the workshop: work orders, inspections, parts, vehicles, mechanics). For the 4–6 top-level areas use the top nav.
- Group links into titled sections; nest at most two levels with a disclosure (
<details>). - Labels are nouns for places, ≤ 3 words. Counts say what they count in nearby text or the page ("4" inspections due today).
- The collapsed rail keeps every destination reachable by icon and tooltip; use it on narrow desktops, not on phones (use the top-nav panel there).
Anatomy
- Collapse button —
.side-nav__collapse(aria-expanded) - Section heading —
.side-nav__heading - Link —
a.side-nav__linkwith icon, label, optional count - Nested group —
details.side-nav__group+summary.side-nav__summary+ chevron - Current indicator — inline-start bar, selected fill, semibold (
aria-current="page")
Examples
Section headings use the next heading level of the page (h2 in an app shell; h4 inside this docs page). 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 |
|---|---|---|
.side-nav | block class | <nav aria-label> sidebar |
[data-collapsed] | attribute (set by JS) | Icon rail |
data-persist | attribute | localStorage key for the collapse state |
.side-nav__header | __collapse | __section | __heading | __list | __list--nested | __link | __icon | __label | __count | __group | __summary | __chevron | parts | See anatomy |
aria-current="page" | attribute | Current page |
aria-expanded (collapse button) | attribute | Expanded / collapsed |
Do and don't
Workshop → Work orders → Open work orders
Fleet → Vans → Electric → North Yard → KX-219
Accessibility
| Key | Behavior |
|---|---|
| Tab | Moves through the collapse button, links and group summaries |
| Enter | Follows a link |
| Enter / Space (summary) | Expands / collapses a nested group |
| Enter / Space (collapse) | Switches between full and icon rail |
- Landmark:
<nav>with a uniquearia-label("Workshop"), different from the top nav's "Main". - Collapsed rail: labels are clipped, not removed, so link names don't change;
js/side-nav.jsaddstitletooltips. - Current page: bar + fill + weight. A group containing the current page shows its summary in bold.
- Forced colors: the current bar uses
Highlight.
Tokens
| Custom property | Purpose |
|---|---|
--color-bg-surface, --color-border-default | Panel |
--color-selected-bg | -fg | -border | Current link |
--color-action-ghost-bg-hover | Hover |
--size-control-md | -sm | Link height (comfortable / compact) |
--color-bg-muted | Count pill |
--motion-duration-base | Collapse width transition (off with reduced motion) |