<!-- index: /slotted/llms.txt -->
# breadcrumb

`data-ui="breadcrumb"` · Trail of links to the current page's ancestors.

## Import

```tsx
import {
  Breadcrumb,
  BreadcrumbDefaultsProvider,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
  BreadcrumbTrigger,
} from '@slotted/react';
```

## Minimal example

Example

```tsx
import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
} from '@slotted/react/breadcrumb';

export default function BreadcrumbBasic() {
  return (
    <Breadcrumb>
      <BreadcrumbList>
        <BreadcrumbItem>
          <BreadcrumbLink href="#">Northwind</BreadcrumbLink>
        </BreadcrumbItem>
        <BreadcrumbItem>
          <BreadcrumbLink href="#">Orders</BreadcrumbLink>
        </BreadcrumbItem>
        <BreadcrumbItem>
          <BreadcrumbPage>ORD-10248</BreadcrumbPage>
        </BreadcrumbItem>
      </BreadcrumbList>
    </Breadcrumb>
  );
}
```

## Anatomy

| Part | Element | Required |
| --- | --- | --- |
| `root` | nav | yes |
| `list` | ol | yes |
| `item` | li | yes |
| `link` | a | no |
| `page` | span | no |
| `trigger` | button | no |
| `separator` | span | no |
| `ellipsis` | button | no |

## Props

| Name | Type | Default | Applies to | Description |
| --- | --- | --- | --- | --- |
| `messages` | `Partial<BreadcrumbMessages>` | — | Breadcrumb | Words laid over the language in force, key by key: the landmark's name (label) and the ellipsis (showHidden) |
| `maxItems` | `number` | 8 | Breadcrumb | The count above which the trail folds; 0 never folds |
| `itemsBeforeCollapse` | `number` | 1 | Breadcrumb | How many crumbs survive at the start of a folded trail |
| `itemsAfterCollapse` | `number` | 2 | Breadcrumb | How many survive at its end |
| `expanded` | `boolean` | — | Breadcrumb | Present means controlled, for the life of the component |
| `defaultExpanded` | `boolean` | false | Breadcrumb | What an uncontrolled trail starts from, read once |
| `overflow` | `'collapse' \| 'wrap'` | collapse | Breadcrumb | What the trail does with crumbs its width cannot hold: fold the middle into the ellipsis, or wrap |
| `separator` | `ReactNode` | — | Breadcrumb | The mark between two crumbs. Absent, the stylesheet draws a rotated rule |
| `href` | `string` | — | BreadcrumbLink | The destination, and every other anchor attribute reaches the element unchanged |
| `current` | `boolean` | false | BreadcrumbTrigger | The switcher of the page the reader is on: writes aria-current="page" and takes the page weight |
| `render` | `(props) => ReactNode` | — | every part | Substitutes the rendered element. Every data attribute is handed to it, so a router link keeps them. |
| `ref` | `Ref<HTMLElement>` | — | every part | Reaches the element, and focus() with it |
| `useBreadcrumb()` | `() => BreadcrumbContextValue` | — | inside a Breadcrumb | The collapse state and the request that moves it, for a control the application writes |
| `BreadcrumbDefaultsProvider` | `maxItems \| itemsBeforeCollapse \| itemsAfterCollapse \| overflow \| separator` | — | Application | Sets those five once for everything below it; a prop on the trail still wins |

## Events

| Name | Payload | When |
| --- | --- | --- |
| `onExpandedChange` | `(expanded: boolean, request: ChangeRequest<boolean>)` | Before the trail expands. The request carries the value it replaces, the reason — pointer or keyboard — and the originating event, and cancelling it commits nothing. |

## Axes and defaults

| Axis | Values | Default |
| --- | --- | --- |
| `overflow` | `collapse`, `wrap` | `collapse` |

## Rules

- The rendered elements are a nav and an ol, which is the whole of the APG Breadcrumb pattern: it lists no keyboard interaction, and the two attributes it does list — a name on the landmark and aria-current="page" on the last crumb — are written here rather than reimplemented.
- The current page is a span rather than a link, because a link to the page the reader is already on goes nowhere. The APG makes aria-current optional there; Breadcrumb writes it anyway, so the end of the trail is announced as this page.
- The separator is never announced. It is drawn as geometry in CSS — a rotated rule, not a character and not a glyph — which is the same reasoning the APG example gives, and it mirrors from :dir(rtl) so a trail inside a left-to-right island leans the way that island reads.
- A crumb the collapse hides carries the hidden attribute, so it leaves the accessibility tree with the page. That is the cost of expanding in place rather than into an overlay, and it is paid by the ellipsis: its accessible name says how many crumbs it hides, and it carries aria-expanded.
- A crumb the width folds is hidden the same way, and the ellipsis counts it with the others. Hiding only the label of a narrow crumb would leave the link named by nothing but an aria-hidden icon; a folded crumb is out of the tree whole, and the ellipsis says so.
- A switcher is a button with aria-haspopup from the menu composed on it, and the switcher of this page keeps aria-current="page", so the end of the trail is still announced as the current page when it opens a menu.
- Pressing the ellipsis removes it, so focus is given to the first crumb it revealed. Focus on a removed element falls to the body, which is the defect that rule exists to prevent.
- A crumb wider than the trail truncates with an ellipsis, and the full string stays in the DOM and in the accessible name — the same rule every truncated string follows.

## Tokens

`--slotted-border-width-thin`, `--slotted-breadcrumb-color`, `--slotted-breadcrumb-color-current`, `--slotted-breadcrumb-color-hover`, `--slotted-breadcrumb-content-gap`, `--slotted-breadcrumb-ellipsis-background-active`, `--slotted-breadcrumb-ellipsis-background-hover`, `--slotted-breadcrumb-ellipsis-focus-ring-offset`, `--slotted-breadcrumb-ellipsis-radius`, `--slotted-breadcrumb-focus-ring-offset`, `--slotted-breadcrumb-font-family`, `--slotted-breadcrumb-font-size`, `--slotted-breadcrumb-gap`, `--slotted-breadcrumb-item-measure`, `--slotted-breadcrumb-line-height`, `--slotted-breadcrumb-page-weight`, `--slotted-breadcrumb-radius`, `--slotted-breadcrumb-row-gap`, `--slotted-breadcrumb-separator-color`, `--slotted-breadcrumb-separator-length`, `--slotted-breadcrumb-separator-skew`, `--slotted-breadcrumb-separator-thickness`, `--slotted-breadcrumb-underline-offset`, `--slotted-breadcrumb-underline-thickness`, `--slotted-control-font-size-md`, `--slotted-control-gap-md`, `--slotted-control-icon-size-md`, `--slotted-control-inner-size-md`, `--slotted-control-radius`, `--slotted-duration-medium`, `--slotted-duration-short`, `--slotted-easing-enter`, `--slotted-easing-standard`, `--slotted-focus-ring-color`, `--slotted-focus-ring-width`, `--slotted-font-family-sans`, `--slotted-font-weight-medium`, `--slotted-line-height-md`, `--slotted-radius-full`, `--slotted-radius-xs`, `--slotted-space-2`, `--slotted-space-3`, `--slotted-target-comfortable`, `--slotted-target-min`, `--slotted-text`, `--slotted-text-muted`, `--slotted-tone-secondary-subtle-active`, `--slotted-tone-secondary-subtle-hover`

## Examples

### Playground

Every input on one trail, driven by the controls below the canvas. Lower maxItems and watch which crumbs survive the fold.

Excerpt — not a complete module

```tsx
<Breadcrumb>
  <BreadcrumbList>
    <BreadcrumbItem>
      <BreadcrumbLink href="/workspace">Workspace</BreadcrumbLink>
    </BreadcrumbItem>
    <BreadcrumbItem>
      <BreadcrumbPage>INV-2026-08-0041</BreadcrumbPage>
    </BreadcrumbItem>
  </BreadcrumbList>
</Breadcrumb>;
```

### A trail that got too deep

Above maxItems the middle folds behind one button, and pressing it expands the trail in place — no overlay, and focus lands on the first crumb it revealed.

Example

```tsx
import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
} from '@slotted/react/breadcrumb';

const LEVELS = ['Northwind', 'Finance', 'Receivables', 'EMEA', 'Germany', 'Invoices'];

export default function BreadcrumbCollapse() {
  return (
    <Breadcrumb maxItems={4} itemsBeforeCollapse={1} itemsAfterCollapse={2}>
      <BreadcrumbList>
        {LEVELS.map((level) => (
          <BreadcrumbItem key={level}>
            <BreadcrumbLink href="#">{level}</BreadcrumbLink>
          </BreadcrumbItem>
        ))}
        <BreadcrumbItem>
          <BreadcrumbPage>INV-2026-08-0041</BreadcrumbPage>
        </BreadcrumbItem>
      </BreadcrumbList>
    </Breadcrumb>
  );
}
```

### The mark between two crumbs

Empty, the stylesheet draws a rotated rule that mirrors in a right-to-left document. Anything placed in the separator replaces the drawing without replacing the element.

Example

```tsx
import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
} from '@slotted/react/breadcrumb';

export default function BreadcrumbSeparator() {
  return (
    <Breadcrumb separator="›">
      <BreadcrumbList>
        <BreadcrumbItem>
          <BreadcrumbLink href="#">Northwind</BreadcrumbLink>
        </BreadcrumbItem>
        <BreadcrumbItem>
          <BreadcrumbLink href="#">Finance</BreadcrumbLink>
        </BreadcrumbItem>
        <BreadcrumbItem>
          <BreadcrumbLink href="#">Receivables</BreadcrumbLink>
        </BreadcrumbItem>
        <BreadcrumbItem>
          <BreadcrumbPage>INV-2026-08-0041</BreadcrumbPage>
        </BreadcrumbItem>
      </BreadcrumbList>
    </Breadcrumb>
  );
}
```

### The current page

The last crumb is a span carrying aria-current="page", which is the value the ARIA specification names for a link inside a set of pages. It gains weight rather than color alone.

Excerpt — not a complete module

```tsx
<BreadcrumbItem>
  <BreadcrumbPage>INV-2026-08-0041</BreadcrumbPage>
</BreadcrumbItem>;
```

### Above the page it describes

Where a trail actually lives: over a heading, at the type size of the interface rather than of the page title. It is not a back button, and it never stands in for one.

Excerpt — not a complete module

```tsx
<header>
  <Breadcrumb>
    <BreadcrumbList>{levels}</BreadcrumbList>
  </Breadcrumb>
  <h1>INV-2026-08-0041</h1>
</header>;
```

### Content the trail did not choose

A German compound, a pasted identifier with no break opportunity, and a single-crumb trail. The row wraps before anything truncates, and a truncated string stays in the accessible name.

Example

```tsx
import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
} from '@slotted/react/breadcrumb';
import { Stack } from '@slotted/react/stack';

export default function BreadcrumbContent() {
  return (
    <Stack gap={4}>
      <Breadcrumb>
        <BreadcrumbList>
          <BreadcrumbItem>
            <BreadcrumbLink href="#">Northwind</BreadcrumbLink>
          </BreadcrumbItem>
          <BreadcrumbItem>
            <BreadcrumbLink href="#">Intercompany freight reconciliation guidelines</BreadcrumbLink>
          </BreadcrumbItem>
          <BreadcrumbItem>
            <BreadcrumbPage>Carrier surcharges</BreadcrumbPage>
          </BreadcrumbItem>
        </BreadcrumbList>
      </Breadcrumb>
      <Breadcrumb>
        <BreadcrumbList>
          <BreadcrumbItem>
            <BreadcrumbLink href="#">Shipments</BreadcrumbLink>
          </BreadcrumbItem>
          <BreadcrumbItem>
            <BreadcrumbPage>7f3a9c0e5b2d4186a9e1c7d3f0b85a62e4d91c07</BreadcrumbPage>
          </BreadcrumbItem>
        </BreadcrumbList>
      </Breadcrumb>
      <Breadcrumb>
        <BreadcrumbList>
          <BreadcrumbItem>
            <BreadcrumbPage>Orders</BreadcrumbPage>
          </BreadcrumbItem>
        </BreadcrumbList>
      </Breadcrumb>
    </Stack>
  );
}
```

### Composition

render substitutes any part for a router link or another element, and BreadcrumbDefaultsProvider decides the separator and the collapse for a whole application.

Excerpt — not a complete module

```tsx
<BreadcrumbLink href="/invoices" render={(props) => <RouterLink {...props} to={props.href} />}>
  Invoices
</BreadcrumbLink>;

<BreadcrumbDefaultsProvider maxItems={5}>
  <App />
</BreadcrumbDefaultsProvider>;
```

### Crumbs that switch between siblings

A ledger and a period each open a menu of their siblings. The open one keeps its underline and turns its chevron, and the period the reader is on still says it is this page.

Example

```tsx
import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbTrigger,
} from '@slotted/react/breadcrumb';
import { Menu, MenuContent, MenuItem, MenuTrigger } from '@slotted/react/menu';

export default function BreadcrumbSwitcher() {
  return (
    <Breadcrumb>
      <BreadcrumbList>
        <BreadcrumbItem>
          <BreadcrumbLink href="#">Northwind</BreadcrumbLink>
        </BreadcrumbItem>
        <BreadcrumbItem>
          <Menu>
            <MenuTrigger
              render={(props) => (
                <BreadcrumbTrigger {...props}>Accounts receivable</BreadcrumbTrigger>
              )}
            />
            <MenuContent>
              <MenuItem>Accounts payable</MenuItem>
              <MenuItem>Accounts receivable</MenuItem>
              <MenuItem>General ledger</MenuItem>
            </MenuContent>
          </Menu>
        </BreadcrumbItem>
        <BreadcrumbItem>
          <Menu>
            <MenuTrigger
              render={(props) => (
                <BreadcrumbTrigger {...props} current>
                  August 2026
                </BreadcrumbTrigger>
              )}
            />
            <MenuContent>
              <MenuItem>July 2026</MenuItem>
              <MenuItem>August 2026</MenuItem>
              <MenuItem>September 2026</MenuItem>
            </MenuContent>
          </Menu>
        </BreadcrumbItem>
      </BreadcrumbList>
    </Breadcrumb>
  );
}
```

### A trail narrower than its crumbs

Drag the column narrower: the middle crumbs fold into the ellipsis from the one nearest the root, the first and the last two stay, and the ellipsis names how many it holds. overflow="wrap" breaks the row instead.

Example

```tsx
import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
} from '@slotted/react/breadcrumb';
import { Stack } from '@slotted/react/stack';
import { Text } from '@slotted/react/typography';

const LEVELS = [
  'Northwind',
  'Distribution centers',
  'Rotterdam',
  'Inbound receiving',
  'Purchase orders',
  'Kiln & Co.',
];

export default function BreadcrumbOverflow() {
  return (
    <Stack gap={5}>
      <Stack gap={2}>
        <Text size="sm" tone="muted">
          overflow="collapse"
        </Text>
        <Breadcrumb>
          <BreadcrumbList>
            {LEVELS.map((level) => (
              <BreadcrumbItem key={level}>
                <BreadcrumbLink href="#">{level}</BreadcrumbLink>
              </BreadcrumbItem>
            ))}
            <BreadcrumbItem>
              <BreadcrumbPage>PO-2026-08-0412</BreadcrumbPage>
            </BreadcrumbItem>
          </BreadcrumbList>
        </Breadcrumb>
      </Stack>
      <Stack gap={2}>
        <Text size="sm" tone="muted">
          overflow="wrap"
        </Text>
        <Breadcrumb overflow="wrap">
          <BreadcrumbList>
            {LEVELS.map((level) => (
              <BreadcrumbItem key={level}>
                <BreadcrumbLink href="#">{level}</BreadcrumbLink>
              </BreadcrumbItem>
            ))}
            <BreadcrumbItem>
              <BreadcrumbPage>PO-2026-08-0412</BreadcrumbPage>
            </BreadcrumbItem>
          </BreadcrumbList>
        </Breadcrumb>
      </Stack>
    </Stack>
  );
}
```

### Keyboard and announcement

Tab reaches every crumb and the ellipsis; Enter follows a crumb; Enter or Space on the ellipsis expands the trail and moves focus to the first crumb it revealed. A switcher takes the keys of the menu composed on it.

Excerpt — not a complete module

```tsx
// The landmark is named, the ellipsis says how many it hides,
// and the last crumb says it is this page.
<Breadcrumb aria-label="Breadcrumb" maxItems={4}>
  <BreadcrumbList>{levels}</BreadcrumbList>
</Breadcrumb>;
```

### controlled.tsx

Example

```tsx
import { useState } from 'react';
import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
} from '@slotted/react/breadcrumb';
import { Button } from '@slotted/react/button';
import { Inline } from '@slotted/react/inline';
import { Stack } from '@slotted/react/stack';
import { Text } from '@slotted/react/typography';

const LEVELS = ['Northwind', 'Finance', 'Receivables', 'EMEA', 'Germany', 'Invoices'];

export default function BreadcrumbControlled() {
  const [expanded, setExpanded] = useState(false);

  return (
    <Stack gap={4}>
      <Breadcrumb expanded={expanded} maxItems={4} onExpandedChange={setExpanded}>
        <BreadcrumbList>
          {LEVELS.map((level) => (
            <BreadcrumbItem key={level}>
              <BreadcrumbLink href="#">{level}</BreadcrumbLink>
            </BreadcrumbItem>
          ))}
          <BreadcrumbItem>
            <BreadcrumbPage>INV-2026-08-0041</BreadcrumbPage>
          </BreadcrumbItem>
        </BreadcrumbList>
      </Breadcrumb>
      <Inline gap={3}>
        <Button disabled={!expanded} onClick={() => setExpanded(false)} variant="outline">
          Fold the trail
        </Button>
        <Text size="sm" tone="muted">
          {expanded ? 'Expanded' : 'Folded'}
        </Text>
      </Inline>
    </Stack>
  );
}
```

### defaults.tsx

Example

```tsx
import {
  Breadcrumb,
  BreadcrumbDefaultsProvider,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
} from '@slotted/react/breadcrumb';
import { Stack } from '@slotted/react/stack';
import { Text } from '@slotted/react/typography';

const LEVELS = ['Northwind', 'Finance', 'Receivables', 'EMEA', 'Germany', 'Invoices'];

export default function BreadcrumbDefaults() {
  return (
    <BreadcrumbDefaultsProvider itemsAfterCollapse={1} maxItems={4}>
      <Stack gap={5}>
        <Stack gap={2}>
          <Text size="sm" tone="muted">
            Inherits the defaults
          </Text>
          <Breadcrumb>
            <BreadcrumbList>
              {LEVELS.map((level) => (
                <BreadcrumbItem key={level}>
                  <BreadcrumbLink href="#">{level}</BreadcrumbLink>
                </BreadcrumbItem>
              ))}
              <BreadcrumbItem>
                <BreadcrumbPage>INV-2026-08-0041</BreadcrumbPage>
              </BreadcrumbItem>
            </BreadcrumbList>
          </Breadcrumb>
        </Stack>
        <Stack gap={2}>
          <Text size="sm" tone="muted">
            maxItems={0} and overflow="wrap" on the trail
          </Text>
          <Breadcrumb maxItems={0} overflow="wrap">
            <BreadcrumbList>
              {LEVELS.map((level) => (
                <BreadcrumbItem key={level}>
                  <BreadcrumbLink href="#">{level}</BreadcrumbLink>
                </BreadcrumbItem>
              ))}
              <BreadcrumbItem>
                <BreadcrumbPage>INV-2026-08-0041</BreadcrumbPage>
              </BreadcrumbItem>
            </BreadcrumbList>
          </Breadcrumb>
        </Stack>
      </Stack>
    </BreadcrumbDefaultsProvider>
  );
}
```

### initially-expanded.tsx

Example

```tsx
import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
} from '@slotted/react/breadcrumb';

const LEVELS = ['Northwind', 'Finance', 'Receivables', 'EMEA', 'Germany', 'Invoices'];

export default function BreadcrumbInitiallyExpanded() {
  return (
    <Breadcrumb defaultExpanded maxItems={4}>
      <BreadcrumbList>
        {LEVELS.map((level) => (
          <BreadcrumbItem key={level}>
            <BreadcrumbLink href="#">{level}</BreadcrumbLink>
          </BreadcrumbItem>
        ))}
        <BreadcrumbItem>
          <BreadcrumbPage>INV-2026-08-0041</BreadcrumbPage>
        </BreadcrumbItem>
      </BreadcrumbList>
    </Breadcrumb>
  );
}
```

### messages.tsx

Example

```tsx
import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
} from '@slotted/react/breadcrumb';

const LEVELS = ['Northwind', 'Finance', 'Receivables', 'EMEA', 'Germany', 'Invoices'];

export default function BreadcrumbMessages() {
  return (
    <Breadcrumb
      maxItems={4}
      messages={{ label: 'Where this invoice sits', showHidden: 'Reveal {count} more levels' }}
    >
      <BreadcrumbList>
        {LEVELS.map((level) => (
          <BreadcrumbItem key={level}>
            <BreadcrumbLink href="#">{level}</BreadcrumbLink>
          </BreadcrumbItem>
        ))}
        <BreadcrumbItem>
          <BreadcrumbPage>INV-2026-08-0041</BreadcrumbPage>
        </BreadcrumbItem>
      </BreadcrumbList>
    </Breadcrumb>
  );
}
```

### page-header.tsx

Example

```tsx
import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
} from '@slotted/react/breadcrumb';
import { Stack } from '@slotted/react/stack';
import { Heading, Text } from '@slotted/react/typography';

export default function BreadcrumbPageHeader() {
  return (
    <Stack gap={2}>
      <Breadcrumb>
        <BreadcrumbList>
          <BreadcrumbItem>
            <BreadcrumbLink href="#">Northwind</BreadcrumbLink>
          </BreadcrumbItem>
          <BreadcrumbItem>
            <BreadcrumbLink href="#">Finance</BreadcrumbLink>
          </BreadcrumbItem>
          <BreadcrumbItem>
            <BreadcrumbLink href="#">Invoices</BreadcrumbLink>
          </BreadcrumbItem>
          <BreadcrumbItem>
            <BreadcrumbPage>INV-2026-08-0041</BreadcrumbPage>
          </BreadcrumbItem>
        </BreadcrumbList>
      </Breadcrumb>
      <Heading level={1} size="lg">
        INV-2026-08-0041
      </Heading>
      <Text size="sm" tone="muted">
        Kiln &amp; Co. · Net 30 · due September 12, 2026
      </Text>
    </Stack>
  );
}
```
