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.
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 in the ALOXE_TOKEN environment variable. Registry has the details.
{
"registries": {
"@aloxe": {
"url": "https://<aloxe-site>/r/{name}.json",
"headers": { "Authorization": "Bearer ${ALOXE_TOKEN}" }
}
}
}Then add the component:
npx shadcn@latest add @aloxe/breadcrumbThe 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/.
@import "tailwindcss";
@import "@aloxe/tokens/aloxe.css";
@import "@aloxe/tokens/tailwind.css";
@source "../components/ui/aloxe";
@source "../../node_modules/@aloxe/react/dist";Installation covers the theme and brand attributes.
Usage
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.
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
navlandmark 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 | Description |
|---|---|---|---|
| children (required) | ReactNode | 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 | 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 (required) | ReactNode | 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 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 and Pricing.