Skip to main content

Core · Navigation

Breadcrumb

Shows where the page sits in the site, as a trail of links to its parents.

Example

The trail to this page, from Docs to the page you are reading.

The trail at the top of this page is the same component.

Known issues

None known.

Code

Copy the markup

HTML
<nav aria-label="Breadcrumb">
  <ol class="luz-breadcrumb">
    <li><a class="luz-breadcrumb__item" href="/">Home</a></li>
    <li><a class="luz-breadcrumb__item" href="/settings/">Settings</a></li>
    <li><span class="luz-breadcrumb__item" aria-current="page">Billing</span></li>
  </ol>
</nav>

Variants and options

There are no modifiers. The separator is drawn by the CSS between two items: there is nothing to write for it.

Class or attributeWhat it does
.luz-breadcrumb
The ordered list: one row of items, which wraps onto more lines when it is narrow. Each <li> after the first starts with a slash
.luz-breadcrumb__item
A parent link, or the current page as text
aria-current="page"
Marks the current page: primary text colour and medium weight

How it works

The APG breadcrumb pattern: a <nav> landmark around an ordered list of links, styled by components/breadcrumb.css. No JavaScript.

  • The list is ordered because the order is the meaning: screen readers announce a list and its number of items.
  • The current page is the last item, a <span> with aria-current="page", not a link to itself.
  • The separator is a border drawn by ::before with empty content, so assistive technology has nothing to read.

Without JavaScript

Nothing changes: the breadcrumb is a list of links and CSS. Without CSS it reads as a numbered list.

Keyboard and ARIA

Tab reaches each parent link in order; Enter follows it. The current page is not in the tab order.

  • Name the <nav> "Breadcrumb" with aria-label, so it differs from the main navigation.
  • aria-current="page" tells screen readers which item is the current page.

Contrast and focus are in the Design tab.

Design

When to use

Use a breadcrumb when pages sit three or more levels deep, so the reader sees where they are and can go up a level.

When not to use

Do not use a breadcrumb on a flat site, or as the only navigation.

  • For the main sections of a site, use a sidebar or a header navigation.
  • For steps in a process, show the step number in the page heading instead.

Do and don't

Do Use the titles of the pages, and end with the current page as text.
Don't Internal names (“UI kit”, “luz-btn”) instead of the titles the reader saw on the way.

Writing the content

Use the title of each page, shortened if it is long.

  • Start at the home or the top of the section.
  • End with the current page, as text, not as a link.

Contrast and focus

Links are secondary text; the current page is primary text.

PartColour on backgroundLightDarkHigh contrastNeeds
Link
--luz-text-secondary on --luz-surface-page
6.2:1
7.5:1
19.3:1
4.5:1
Current page
--luz-text-primary on --luz-surface-page
15.8:1
15.1:1
21.0:1
4.5:1
Separator
--luz-text-muted on --luz-surface-page
4.9:1
5.6:1
9.0:1
3:1
Focus ring
--luz-focus-ring on --luz-surface-page
5.6:1
7.7:1
21.0:1
3:1

Measured from the token values of each mode, rounded down. Needs is the WCAG 2.2 AA minimum: 4.5:1 for text, 3:1 for focus rings, borders and icons.

  • Focus: each link has the shared link ring, a 2 px --luz-focus-ring outline 2 px outside the text.
  • Not colour alone: the current page is not a link, and it is heavier (weight 500).

Tokens it uses

The 6 tokens that components/breadcrumb.css reads, by family. Each family links to its page, with the values in every mode. In Figma they are variables with the same names: see Tokens in Figma.

Spacing and sizing
--luz-space-xs
Typography
--luz-font-sans, --luz-text-sm

Keyboard and ARIA are in the Code tab.