# Breadcrumbs

Where a page sits: each level up as a link, separated by chevrons, then the current page as plain text. Past maxVisible, the middle levels fold into a … menu, keeping the first level and those nearest the page. Long labels clip with their full text on hover.

- Beta: ready to use; its API can still change in a minor release.
- Category: Navigation

```tsx
import { Breadcrumbs } from "@leap-crm/design-system";
```

## Best practices

- Do: Use it on a page that sits below other pages, like a contact's documents under the contact under Contacts. The last item is the current page and never links.
- Do: Pass your router's Link as each crumb's `render`, so going up a level stays inside the app.
- Do: Keep long labels whole, like a trust's full name. Each crumb clips through `Truncate` and shows the full label on hover.
- Do: Lower `maxVisible` where the header is narrow. The middle levels fold into a … menu and the first level and those nearest the page stay.
- Don't: Use it to move between views of one record, like a contact's details and documents. Use `Tabs` or `UnderlineTabs`: breadcrumbs show levels, not siblings.

## Keyboard

| Keys | What they do |
| --- | --- |
| Enter | Follows the focused crumb. |
| Enter, Space, ArrowDown | On the ⋯ button, opens the menu of hidden crumbs with focus on the first. |
| Escape | Closes that menu and returns focus to the ⋯ button. |

## Related

- [Tabs](./tabs.md)
- [Text Link](./text-link.md)
- [Dropdown Menu](./dropdown-menu.md)
- [Pagination](./pagination.md)

## Examples

What the examples import:

```tsx
import { Breadcrumbs } from "@leap-crm/design-system";
```

### Levels

Contacts, then the contact, then the page you're on.

```tsx
<Breadcrumbs
  items={[
    { label: "Contacts", href: "/breadcrumbs" },
    { label: "Jane Citizen", href: "/breadcrumbs" },
    { label: "Documents" },
  ]}
/>
```

### Folded

Six levels with maxVisible={4}: the first level, the … menu holding the middle three, the level above the page, and the page.

```tsx
<Breadcrumbs
  maxVisible={4}
  items={[
    { label: "Opportunities", href: "/breadcrumbs" },
    { label: "Conveyancing", href: "/breadcrumbs" },
    { label: "Purchase", href: "/breadcrumbs" },
    {
      label:
        "Hartley Okafor Moreau Family Trust (Superannuation Fund No. 2)",
      href: "/breadcrumbs",
    },
    { label: "Settlement", href: "/breadcrumbs" },
    { label: "Cost agreement" },
  ]}
/>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `items` (required) | `Breadcrumb[]` |  | From the top level down to the current page, which comes last. |
| `maxVisible` | `number` | `4` | How many crumbs show before the middle ones fold into a menu. |
| `aria-label` | `string` | `"Breadcrumb"` | Names the navigation. |
| `className` | `string` |  | Classes added to the root element, merged with its own. Tokens only. |
