# Breadcrumb

The path to the current page: an ordered list of links in a labelled `<nav>`.

_Diagram: The breadcrumb is the row of links above the page heading in the content area, from the top section to the current page._

## Live example

### Breadcrumb

```html
<nav aria-label="Breadcrumb" data-breadcrumb>
  <ol>
    <li><a href="#trail-title">Home</a></li>
    <li><a href="#trail-title">Molecules</a></li>
    <li><a href="#trail-title" aria-current="page">Breadcrumb</a></li>
  </ol>
</nav>
```

### A long trail wraps

```html
<nav aria-label="Breadcrumb for the archive" data-breadcrumb>
  <ol>
    <li><a href="#long-title">Home</a></li>
    <li><a href="#long-title">Documentation</a></li>
    <li><a href="#long-title">Components and patterns</a></li>
    <li><a href="#long-title">Navigation</a></li>
    <li><a href="#long-title">Archive</a></li>
    <li><a href="#long-title" aria-current="page">Breadcrumbs in older releases</a></li>
  </ol>
</nav>
```

## Attributes

| Attribute or value | Where | Effect |
| --- | --- | --- |
| `data-breadcrumb` | `<nav aria-label="Breadcrumb">` |  |
| `aria-current="page"` | the last link (native ARIA) |  |

### Keyboard

See the keyboard section of the [APG Breadcrumb pattern](https://www.w3.org/WAI/ARIA/apg/patterns/breadcrumb/).

## Accessibility

- [`aria-current="page"`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-current) marks the current page, which is also bold ([WCAG 1.4.1](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html)).
- Separators use CSS [alternative text](https://developer.mozilla.org/en-US/docs/Web/CSS/content#alternative_text) `""`, so they are not read.
- Links are at least 24px tall ([WCAG 2.5.8](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html)).

## Specifications

- [APG Breadcrumb pattern](https://www.w3.org/WAI/ARIA/apg/patterns/breadcrumb/)
- [HTML `<nav>` element](https://html.spec.whatwg.org/multipage/sections.html#the-nav-element)
- [MDN `aria-current`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-current)
- [WCAG F73](https://www.w3.org/WAI/WCAG22/Techniques/failures/F73)

## See also

- [Molecules](https://domestic-ui.odonckers.dev/molecules/index.md)
- Source: [`css/components/molecules/breadcrumb.css`](https://github.com/odonckers/domestic-ui/blob/main/css/components/molecules/breadcrumb.css), [`examples/molecules/breadcrumb.html`](https://github.com/odonckers/domestic-ui/blob/main/examples/molecules/breadcrumb.html)
- Demos: Orders view ([Plain HTML](https://github.com/odonckers/domestic-ui/blob/main/demos/vanilla/orders.html), [React](https://github.com/odonckers/domestic-ui/blob/main/demos/react/src/OrdersPage.tsx), [Angular](https://github.com/odonckers/domestic-ui/tree/main/demos/angular/src/app/orders), [Astro](https://github.com/odonckers/domestic-ui/blob/main/demos/astro/src/pages/orders.astro), [Vue](https://github.com/odonckers/domestic-ui/blob/main/demos/vue/src/OrdersPage.vue), [Svelte](https://github.com/odonckers/domestic-ui/blob/main/demos/svelte/src/OrdersPage.svelte))

## How other systems do it

For comparison only; these are not the standard this system follows.

- [Apple Human Interface Guidelines: Path controls](https://developer.apple.com/design/human-interface-guidelines/path-controls)
- Material Design 3: No equivalent
- [Vercel Geist: Breadcrumbs](https://vercel.com/geist/breadcrumbs)
