# Breadcrumb

> Shows where the current page sits in the site hierarchy.

Use a breadcrumb on pages that sit two or more levels deep, so people see where they are and can go up a level. It doesn't replace the main navigation.

Pro example source is available to licensed users. See [Pro access](/docs/pro/access).

## Installation

Pro components install from the Aloxe registry with the shadcn CLI. Once per project, add the registry to `components.json` and put a [registry token](/account/tokens) in the `ALOXE_TOKEN` environment variable. [Registry](/docs/pro/registry) has the details.

```json
{
  "registries": {
    "@aloxe": {
      "url": "https://<aloxe-site>/r/{name}.json",
      "headers": { "Authorization": "Bearer ${ALOXE_TOKEN}" }
    }
  }
}
```

Then add the component:

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

The CLI copies the source into `components/ui/aloxe/`, so it never overwrites your own `ui` components. It also installs `@aloxe/react`, `@aloxe/tokens` and `@base-ui/react`.

Import the tokens once in your global stylesheet, after Tailwind, and add an `@source` for the copied files and one for `@aloxe/react`, so Tailwind generates their classes. `@source` paths are relative to the stylesheet; these assume `src/app/globals.css` and `src/components/ui/aloxe/`.

```css
@import "tailwindcss";
@import "@aloxe/tokens/aloxe.css";
@import "@aloxe/tokens/tailwind.css";
@source "../components/ui/aloxe";
@source "../../node_modules/@aloxe/react/dist";
```

[Installation](/docs/getting-started/installation) covers the theme and brand attributes.

## Usage

```tsx
import Link from "next/link";
import { Breadcrumb, BreadcrumbItem } from "@/components/ui/aloxe/breadcrumb";

<Breadcrumb>
  <BreadcrumbItem href="/account" linkComponent={Link}>Account</BreadcrumbItem>
  <BreadcrumbItem href="/account/licenses" linkComponent={Link}>Licenses</BreadcrumbItem>
  <BreadcrumbItem current>Team license</BreadcrumbItem>
</Breadcrumb>
```

List the ancestors from the top down, and end on the current page with `current`. Chevrons between items are added for you.

## Examples

### Long names

Items wrap onto a second line when the row is full, as the current page does here. Cap long ancestor names with a `max-w-*` class so they truncate, and add a `title` so the full name shows on hover. The current page keeps its full name.

Pro example source is available to licensed users. See [Pro access](/docs/pro/access).

## Accessibility

| Key | Action |
| --- | --- |
| Tab and Shift+Tab | Move between the ancestor links. The current page isn't a link, so it isn't a tab stop. |
| Enter | Follows the focused link. |

- A `nav` landmark named "Breadcrumb" around an ordered list, so screen readers announce the number of levels.
- The current page has `aria-current="page"`.
- Chevrons are decorative and hidden from screen readers.
- Links underline on hover and show the focus ring on keyboard focus.

## API reference

Every part accepts `className` and renders a `data-aloxe` attribute you can target in CSS, such as `[data-aloxe="breadcrumb-item"]`.

**Breadcrumb** (extends <nav>)

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `children` | `ReactNode` |  | Yes | BreadcrumbItem elements, from the top level down to the current page. |
| `aria-label` | `string` | `"Breadcrumb"` |  | Names the nav landmark. |
| `className` | `string` |  |  | Classes for the nav element. |

**BreadcrumbItem** (extends <li> + <a>)

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `href` | `string` |  |  | The ancestor page's URL. Ignored when current. |
| `current` | `boolean` | `false` |  | The page you are on: plain text with aria-current="page". Use it on the last item. |
| `linkComponent` | `ElementType` | `"a"` |  | The element for the link, such as Next.js Link. |
| `children` | `ReactNode` |  | Yes | The page name. |
| `className` | `string` |  |  | Classes for the link or text, such as max-w-24 to truncate a long name. |

## Figma

Matches the **Breadcrumb** and **Breadcrumb item** components in the Pro Figma file. Breadcrumb item `Type` (`Link`, `Current`) maps to passing `href` or `current`.

See [Figma](/docs/getting-started/figma) for where to get the file and how its names map to code.

## Pro

Breadcrumb is part of Aloxe Pro. The previews on this page are open to everyone; the Code tab shows the example source once you sign in with a Pro license. See [Access and licenses](/docs/pro/access) and [Pricing](/pricing#pro).
