Breadcrumb

A navigation trail with separators, collapsible ellipsis, and a standalone back link for page headers.

Installation

$
npx shadcn@latest add https://ui.mattdowney.com/r/breadcrumb.json

Usage

import {
  Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink,
  BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis, BreadcrumbBack,
} from "@/components/ui/breadcrumb"

Examples

Default

The full trail, one BreadcrumbItem per level. The last crumb is a BreadcrumbPage, not a link: it is the page you are already on.

A standalone “up one level” affordance for page headers. Use size="lg" at header scale.

Collapsed

Collapse the middle of a long trail behind an ellipsis.

Collapsed with Dropdown

Wrap the ellipsis in a dropdown to reveal the hidden crumbs.

Long current page

A long record name as the last crumb stops at 20rem with an ellipsis, and the full name stays in title. Change the cap with a max-w-* on BreadcrumbPage.

API Reference

PropTypeDefaultDescription
renderBreadcrumbLink, BreadcrumbBackReact.ReactElementNoneReplaces the default <a> with your own element, e.g. render={<Link href="/" />}. Base UI merges props onto it.
sizeBreadcrumbBack"default" | "lg""default"default is inline/toolbar scale (14px); lg sits at page-header scale (20px). The chevron scales with it.
classNameBreadcrumbPagestringNoneThe current crumb, and every link crumb, truncates at max-w-crumb (24 characters, --container-crumb) with an ellipsis, and a plain-text name is repeated in title so the full name stays reachable. Pass another max-w-* to change the cap.
childrenBreadcrumbSeparatorReact.ReactNodeNoneOverrides the default chevron separator, e.g. pass a / for a slash-style trail.
renderBreadcrumbLink, BreadcrumbBackReact.ReactElementReplaces the default <a> with your own element, e.g. render={<Link href="/" />}. Base UI merges props onto it.
sizeBreadcrumbBack"default" | "lg" = "default"default is inline/toolbar scale (14px); lg sits at page-header scale (20px). The chevron scales with it.
classNameBreadcrumbPagestringThe current crumb, and every link crumb, truncates at max-w-crumb (24 characters, --container-crumb) with an ellipsis, and a plain-text name is repeated in title so the full name stays reachable. Pass another max-w-* to change the cap.
childrenBreadcrumbSeparatorReact.ReactNodeOverrides the default chevron separator, e.g. pass a / for a slash-style trail.