Breadcrumb
Shows where the current page sits in the hierarchy, with links back up.
When to use
- Pages two or more levels deep, where users move back up: a source inside a workspace.
When not to use
- The main navigation: use Sidebar or Navigation Menu.
- Moving between pages of one list: use Pagination.
- A flat site one level deep: the page title is enough.
Install
npx shadcn@latest add @clinia/breadcrumbAnatomy
- 1Link
[data-slot=breadcrumb-item] atext-muted-foreground · hover:text-foreground - 2Separator
data-slot="breadcrumb-separator"size-3.5 · aria-hidden - 3Current page
data-slot="breadcrumb-page"text-foreground · aria-current
Clinia rules
- The last item is
BreadcrumbPage, the current page, intext-foregroundwith no link. Earlier items are links intext-muted-foreground. - Each label matches the title of the page it links to.
- Past four levels, keep the first and the last two, and collapse the middle into
BreadcrumbEllipsis.
Do and don't
Accessibility
Built in
- The current page is
BreadcrumbPage: a<span>withrole="link",aria-disabled="true"andaria-current="page", so a screen reader reads it as the current page in the trail, and it takes no focus and no click. - Renders a
<nav>landmark labelledbreadcrumb, with the trail as an ordered list.aria-labelreplaces the label. - Separators and the ellipsis are hidden from screen readers, so the trail is read as its links alone.
Your responsibility
- On a page in another language, pass
aria-labelin that language, such asaria-label="Fil d'Ariane"in French. - If the ellipsis hides levels users need, make it a Button that opens a Dropdown Menu of those levels, with an
aria-labelsuch asShow hidden levels. - Render router links with
render={<Link href="/workspaces" />}onBreadcrumbLink.
How to test
- Press Tab through the trail: focus moves link by link and skips the current page.
- With a screen reader, open the landmarks list:
breadcrumbis there. The list is announced with its item count, and the last item as the current page.
API
| Prop | Values | Default | Description |
|---|---|---|---|
| aria-label | string | – | Names the navigation landmark for screen readers. Pass it in the page's language, such as "Fil d'Ariane" on a French page. |
All other props come from the native nav element.