# Breadcrumb

Breadcrumb is a neobrutalist React component from Cruise UI. Where a page sits in the site; the middle collapses into "…" on phones.

Install (with the @cruiseui registry in components.json, see Installation):

```bash
npx shadcn@latest add @cruiseui/breadcrumb
```

Import: `import { CruiseBreadcrumb } from "@/components/cruise/breadcrumb";`

## When to use

Deep sites (shops, docs, settings) where people step back up.

## When not to

Sites one or two levels deep.

## Example (React)

```tsx
import { CruiseBreadcrumb } from "@/components/cruise/breadcrumb";

export default function BreadcrumbExample() {
  return (
    <CruiseBreadcrumb
      items={[
        { label: "Home", href: "#" },
        { label: "Shop", href: "#" },
        { label: "Cakes", href: "#" },
        { label: "Birthday cakes", href: "#" },
        { label: "Classic Celebration Cake" },
      ]}
    />
  );
}
```

## HTML

Needs theme.css (https://cruiseui.dev/theme.css).

```html
<nav class="breadcrumb" aria-label="Breadcrumb">
  <ol>
    <li><a href="/">Home</a></li>
    <li class="breadcrumb-more-item menu-wrap" data-menu>
      <span class="breadcrumb-sep" aria-hidden="true">/</span>
      <button type="button" class="breadcrumb-more" aria-haspopup="menu" aria-expanded="false" aria-controls="crumb-menu" aria-label="Show 3 more pages">…</button>
      <div class="menu" role="menu" id="crumb-menu" hidden>
        <a class="menu-item" role="menuitem" tabindex="-1" href="/shop">Shop</a>
        <a class="menu-item" role="menuitem" tabindex="-1" href="/shop/cakes">Cakes</a>
        <a class="menu-item" role="menuitem" tabindex="-1" href="/shop/cakes/birthday">Birthday cakes</a>
      </div>
    </li>
    <li data-middle><span class="breadcrumb-sep" aria-hidden="true">/</span><a href="/shop">Shop</a></li>
    <li data-middle><span class="breadcrumb-sep" aria-hidden="true">/</span><a href="/shop/cakes">Cakes</a></li>
    <li data-middle><span class="breadcrumb-sep" aria-hidden="true">/</span><a href="/shop/cakes/birthday">Birthday cakes</a></li>
    <li><span class="breadcrumb-sep" aria-hidden="true">/</span><span aria-current="page">Classic Celebration Cake</span></li>
  </ol>
</nav>
```

## Props: CruiseBreadcrumb

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `items` | `CruiseCrumb[]` | — | — |
| `separator?` | `"slash" \| "chevron"` | `"chevron"` | — |
| `popupClassName?` | `string` | — | Extra classes on the "…" menu, e.g. "nepa-mode" (it renders in <body>). |
| `className?` | `string` | — | — |

## Accessibility

- <nav aria-label="Breadcrumb"> with an <ol>; the last item has aria-current="page" and is not a link.
- The "…" button has an aria-label and opens a keyboard-friendly menu.
