Tearsheet

Issue 01 · Navigation · p.52

Breadcrumb

Shows where the page sits in the site hierarchy, using an ordered list.

Why it works: Separators are drawn with CSS so screen readers don’t read them out. The last item is the current page.

Try it:
Receipt: axe clean · contrast 6.7:1 · 3 tab stops · RTL ✓ · long text ✓

Tab order

  1. link "Home":
  2. link "Settings":
  3. link "Notifications":

What assistive tech is given

- navigation "Breadcrumb":
  - list:
    - listitem:
      - link "Home":
        - /url: "#"
    - listitem:
      - text: /
      - link "Settings":
        - /url: "#"
    - listitem:
      - text: /
      - link "Notifications":
        - /url: "#"

Automated checks in CI (axe in Chromium, reduced motion on). They catch a lot, not everything: still try it with a screen reader.

See it in the zine npx -y tearsheet add breadcrumb

Needs the shared tokens.css once per project.

HTML + CSS

index.html
<!-- tearsheet breadcrumb vb646e028 · https://qusaialjbali.github.io/tearsheet/zine/parts/breadcrumb.html -->
<nav class="breadcrumb" aria-label="Breadcrumb">
  <ol>
    <li><a href="#">Home</a></li>
    <li><a href="#">Settings</a></li>
    <li><a href="#" aria-current="page">Notifications</a></li>
  </ol>
</nav>
styles.css
/* tearsheet breadcrumb vb646e028 · https://qusaialjbali.github.io/tearsheet/zine/parts/breadcrumb.html */
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}
.breadcrumb li + li::before {
  content: "/";
  margin: 0 10px;
  color: var(--ui-border-strong);
}
.breadcrumb a {
  color: var(--ui-muted);
  text-decoration: none;
  border-radius: 4px;
}
.breadcrumb a:hover { color: var(--ui-text); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb a:focus-visible { outline: none; box-shadow: var(--ui-focus); }
.breadcrumb a[aria-current="page"] { color: var(--ui-text); font-weight: 600; pointer-events: none; }

React

Breadcrumb.jsx
/* tearsheet breadcrumb vb646e028 · https://qusaialjbali.github.io/tearsheet/zine/parts/breadcrumb.html */
import './Breadcrumb.css';

export function Breadcrumb() {
  return (
    <nav className="breadcrumb" aria-label="Breadcrumb">
      <ol>
        <li><a href="#">Home</a></li>
        <li><a href="#">Settings</a></li>
        <li><a href="#" aria-current="page">Notifications</a></li>
      </ol>
    </nav>
  );
}
Breadcrumb.css
/* tearsheet breadcrumb vb646e028 · https://qusaialjbali.github.io/tearsheet/zine/parts/breadcrumb.html */
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}
.breadcrumb li + li::before {
  content: "/";
  margin: 0 10px;
  color: var(--ui-border-strong);
}
.breadcrumb a {
  color: var(--ui-muted);
  text-decoration: none;
  border-radius: 4px;
}
.breadcrumb a:hover { color: var(--ui-text); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb a:focus-visible { outline: none; box-shadow: var(--ui-focus); }
.breadcrumb a[aria-current="page"] { color: var(--ui-text); font-weight: 600; pointer-events: none; }

Vue

Breadcrumb.vue
<!-- tearsheet breadcrumb vb646e028 · https://qusaialjbali.github.io/tearsheet/zine/parts/breadcrumb.html -->
<template>
  <nav class="breadcrumb" aria-label="Breadcrumb">
    <ol>
      <li><a href="#">Home</a></li>
      <li><a href="#">Settings</a></li>
      <li><a href="#" aria-current="page">Notifications</a></li>
    </ol>
  </nav>
</template>

<style scoped>
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}
.breadcrumb li + li::before {
  content: "/";
  margin: 0 10px;
  color: var(--ui-border-strong);
}
.breadcrumb a {
  color: var(--ui-muted);
  text-decoration: none;
  border-radius: 4px;
}
.breadcrumb a:hover { color: var(--ui-text); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb a:focus-visible { outline: none; box-shadow: var(--ui-focus); }
.breadcrumb a[aria-current="page"] { color: var(--ui-text); font-weight: 600; pointer-events: none; }
</style>

Svelte

Breadcrumb.svelte
<!-- tearsheet breadcrumb vb646e028 · https://qusaialjbali.github.io/tearsheet/zine/parts/breadcrumb.html -->
<nav class="breadcrumb" aria-label="Breadcrumb">
  <ol>
    <li><a href="#">Home</a></li>
    <li><a href="#">Settings</a></li>
    <li><a href="#" aria-current="page">Notifications</a></li>
  </ol>
</nav>

<style>
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}
.breadcrumb li + li::before {
  content: "/";
  margin: 0 10px;
  color: var(--ui-border-strong);
}
.breadcrumb a {
  color: var(--ui-muted);
  text-decoration: none;
  border-radius: 4px;
}
.breadcrumb a:hover { color: var(--ui-text); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb a:focus-visible { outline: none; box-shadow: var(--ui-focus); }
.breadcrumb a[aria-current="page"] { color: var(--ui-text); font-weight: 600; pointer-events: none; }
</style>