Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

nav

Navigation sections containing links to other pages or parts of the page. Used for primary navigation, table of contents, breadcrumbs, and pagination.

Usage

Use the <nav> element for:

  • Primary site navigation in the header
  • Secondary navigation in sidebars or footers
  • Breadcrumb navigation
  • Table of contents
  • Pagination links
  • Hierarchical disclosure navigation for documentation sidebars (see .tree below) — not application tree widgets

Not all groups of links need to be in a nav element. Reserve nav for major navigation blocks. Use aria-label or aria-labelledby to distinguish multiple nav elements.

Examples

Default

Basic nav with styled list and links.

.horizontal

Horizontal layout for header navigation.

.vertical

Explicit vertical layout for sidebar navigation.

.pills

Pill-shaped links with rounded backgrounds.

.tabs

Tab-style navigation with bottom border indicators.

.breadcrumb

Breadcrumb navigation with separator characters. Use <ol> for proper semantics, give the <nav> an aria-label and mark the last crumb aria-current="page". This is the zero-JavaScript breadcrumb; separators are decorative CSS (empty alt text) and are not announced. For JSON-LD, auto-generation from the URL or an expandable collapsed trail, use <bread-crumb>.

.breadcrumb separators

The default separator is “›”, from the --sep-breadcrumb token. Use data-separator to change it. In a right-to-left trail (dir="rtl") the directional separators flip: the default and chevron become “‹” and arrow becomes “←”. The RTL default comes from --sep-breadcrumb-rtl, so set both tokens if you change the glyph.

.breadcrumb collapsed and truncated

Use data-collapsed to hide middle items for deep hierarchies: the first crumb, the parent (second-to-last) and the current page stay visible, with a decorative ellipsis before the parent. Without JavaScript the hidden crumbs cannot be reached, so prefer <bread-crumb data-collapsed>, which adds a "Show full path" button. Put data-truncated on an <li> to ellipsize a long label.

.bottom

Sticky bottom tab bar for mobile navigation. Stacks icon and label vertically in each link and pads for the device safe area. Add .frosted (class="bottom frosted") for a translucent, blurred background that lets content show through; it uses the --glass-* tokens.

.minimal

Subtle, minimal link styling.

.pagination

Page navigation for multi-page content.

.pagination variants

Ellipsis, simple (prev/next only), and compact (connected buttons) variants.

.pagination-bar

A three-column bar for result lists: result count, the pagination nav, and a page-size picker. Put .pagination-bar on a wrapper such as <footer>, with .pagination-info and .page-size-selector on its other children. Inside a container narrower than 500px the bar stacks, with the pagination first. The pagination list itself wraps onto more lines on narrow screens rather than overflowing.

For the full pattern, see Pagination.

.steps

A step indicator for multi-step flows (checkout, onboarding). Use an <ol>; the circles are numbered by a CSS counter. Mark the current step aria-current="step" and finished steps data-completed (the number becomes a check mark). A link inside a completed step lets people go back. data-labels="below" puts labels under the circles, data-direction="vertical" stacks the steps, and data-size="sm|lg" changes the circle size. Connectors use logical properties, so the indicator mirrors in right-to-left pages.

Interactive wizards, validation and more layouts are on the Steps pattern page.

Right to left

Every variant uses logical properties. Breadcrumb separators flip, step connectors run from the inline start, and compact pagination and tree links round the correct ends.

Dropdowns in a nav

Put a <drop-down> in a nav list item for a sub-menu. The trigger picks up the nav’s link padding, colours and hover, and gets a chevron that turns when open. Mark the trigger aria-current="true" (or .active) when the current page is in its section. The menu keeps its pop-up behaviour at every width; a phone layout that needs a different pattern should use <nav-bar> or a mobile menu.

.tree (disclosure tree navigation)

Hierarchical “tree-style” navigation using <details> and <summary> for collapsible sections. Uses +/- indicators for expand/collapse state.

.tree nested

Tree navigation supports multiple nesting levels for deep hierarchies.

.tree compact

Use data-density="compact" for tighter spacing in dense navigation. (For a whole region, use data-layout-density instead.)

Variants

Layout Variants

Class Description
.horizontal Flexbox row layout with wrapping
.vertical Flexbox column layout (default behavior)

Style Variants

Class Description
.pills Fully rounded links with hover/active backgrounds
.tabs Bottom border indicators with underline on current page
.breadcrumb Horizontal list with separators; supports data-separator, data-collapsed, data-truncated
.minimal Subtle muted links with minimal padding
.pagination Page navigation with prev/next controls; supports data-variant, data-size
.tree Hierarchical disclosure navigation using <details>/<summary>; supports data-density. Not an ARIA tree widget.
.bottom Sticky bottom tab bar for mobile; flex row with icon+label stacking and safe-area padding
.bottom.frosted Translucent, blurred bottom bar (--glass-* tokens)
.steps Step indicator; supports data-labels="below", data-direction="vertical", data-size; steps use aria-current="step" and data-completed. See the Steps pattern

Helper Classes

Class Description
.pagination-bar Grid wrapper: info, pagination, page-size picker; stacks below a 500px container
.pagination-info Muted result-count text; <strong> inside is emphasised
.page-size-selector Inline label + <select> for items per page, aligned to the end

Breadcrumb Attributes

Attribute Values Description
data-separator chevron, arrow, dot, pipe Changes the separator character (default is “›” from --sep-breadcrumb; flips in RTL)
data-collapsed boolean Hides middle items: shows the first crumb, a decorative ellipsis, the parent and the current page. Hidden crumbs are not reachable without JS; use <bread-crumb> for an expand button.
data-truncated on item On an <li>: truncates its link label with an ellipsis (max 10rem)

Pagination Attributes

Attribute Values Description
data-variant simple, compact Display variant: simple shows only prev/next, compact connects buttons
data-size sm, lg Size variant (default is medium)
data-prev on link Marks the "previous" link
data-next on link Marks the "next" link
data-ellipsis on span Marks ellipsis placeholder (non-interactive)
data-info on span Page info text (e.g., "Page 3 of 10")

Tree Attributes

Attribute Values Description
data-density compact Reduces spacing for dense navigation
open on <details> Expands section by default

Styling the current page

The link marked aria-current="page" (or .active) is styled from two tokens. Set them on the nav, or on :root for every nav:

TokenDefaultUsed by
--color-active-textvar(--color-interactive)Default, .horizontal, .vertical, .tabs, .bottom and dropdown items
--color-active-bgtransparentDefault, .horizontal, .vertical, .bottom (.tabs keeps it transparent and marks the item with a border)

Colour is not the only cue: in the default, .horizontal, .vertical, .minimal and .bottom navs the current link is also underlined (WCAG 1.4.1). Variants that mark it another way turn the underline off: .pills and .pagination (fill), .tabs (border), .tree (inline-start bar) and .breadcrumb (position). Set --nav-active-decoration: none on a nav to remove it when you add your own non-colour cue. The underline is locked the same way as the colour, because many themes remove link underlines.

.minimal uses body text color and weight as well as the underline. .pills and .pagination fill the current item with --color-interactive and pick black or white text for it automatically (contrast-color(), with --color-text-on-interactive as the fallback in older browsers).

Why tokens rather than a color rule: many themes color links, and theme styles sit in a higher cascade layer than nav. Nav therefore locks the current item's text color with !important so no theme can make it vanish; that rule reads the tokens above, so they are the way to change it. A test renders the current item under every theme to keep it legible.

Accessibility

  • Nav creates a navigation landmark for screen reader navigation
  • Use aria-label to distinguish multiple nav elements (e.g., "Main navigation", "Footer navigation")
  • Use aria-current="page" on the link to the current page
  • Breadcrumbs should use <ol> for ordered sequence semantics
  • Ensure sufficient color contrast for link text and focus states
  • Links should have visible focus indicators
  • Tree navigation uses native <details>/<summary> which are keyboard accessible and announce expand/collapse state

Related

  • <header> - Primary nav typically lives in site headers
  • <footer> - Secondary nav often appears in footers
  • <aside> - Sidebar nav can be placed in asides
  • <main> - Nav should be outside main content area
  • ARIA states - aria-current for the active link
↑