React Breadcrumb
A responsive React breadcrumb whose middle items fold into a menu when space runs out, and unfold again when there is room.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/breadcrumb.jsonFour items fit.
BreadcrumbdefaultBreadcrumbLabels
Collapses to fit
Drag the slider: middle items fold into the “…” menu (arrow keys, typeahead and Escape work inside it) and come back as the row widens. The last item is the current page, with aria-current="page".
Container width
import { Breadcrumb } from "@/components/sheenui/breadcrumb/breadcrumb";
// Package build (after the first npm release, or a packed tarball): import { Breadcrumb } from "@sheenui/theme";
import { House as HomeIcon } from "lucide-react";
export function Example() {
return (
<Breadcrumb
items={[
{ label: "Home", href: "/", icon: <HomeIcon />, iconOnly: true },
{ label: "Acme workspace", href: "/acme" },
{ label: "Engineering", href: "/acme/engineering" },
{ label: "Platform team", href: "/acme/engineering/platform" },
{ label: "Projects", href: "/acme/engineering/platform/projects" },
{ label: "Q3 roadmap", href: "/acme/engineering/platform/projects/q3" },
{ label: "Launch checklist" }, // the current page
]}
/>
);
}Files to copy
5 folders · 6 files · 4 packages
- From
theme/src/ components/breadcrumb/hooks/{use-media-query.ts, use-preferences.ts}motion/tokens.tslib/{cn.ts, popup-a11y.ts, popup-motion.ts}styles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/breadcrumb.jsonRegistry item: breadcrumb. The styles need the Tailwind v4 glass UI setup.- Packages
pnpm add @base-ui/react clsx motion tailwind-merge
Styles
A glass pill, slash and dot separators, a small size, and maxItems to always collapse long trails.
import { Breadcrumb, type BreadcrumbItem } from "@/components/sheenui/breadcrumb/breadcrumb";
// Package build (after the first npm release, or a packed tarball): import { Breadcrumb, type BreadcrumbItem } from "@sheenui/theme";
const items: BreadcrumbItem[] = [
{ label: "Home", href: "#" },
{ label: "Projects", href: "#projects" },
{ label: "SheenUI" },
];
const trail: BreadcrumbItem[] = [
{ label: "Home", href: "#" },
{ label: "Acme", href: "#acme" },
{ label: "Engineering", href: "#engineering" },
{ label: "Platform", href: "#platform" },
{ label: "Billing service" },
];
export function Example() {
// Several breadcrumbs on one page: give each nav its own name.
return (
<>
<Breadcrumb variant="glass" items={items} labels={{ nav: "Breadcrumb (glass)" }} />
<Breadcrumb separator="slash" items={items} labels={{ nav: "Breadcrumb (slash)" }} />
<Breadcrumb separator="dot" size="sm" items={items} labels={{ nav: "Breadcrumb (dot)" }} />
{/* maxItems always keeps the first item, a "…" menu and the last items */}
<Breadcrumb maxItems={3} items={trail} labels={{ nav: "Breadcrumb (collapsed)" }} />
</>
);
}Router links and translations
renderLink renders every link through your router, including the links inside the collapse menu. Every string the component adds is a prop.
import { Breadcrumb, type BreadcrumbItem } from "@/components/sheenui/breadcrumb/breadcrumb";
// Package build (after the first npm release, or a packed tarball): import { Breadcrumb, type BreadcrumbItem } from "@sheenui/theme";
import { Link } from "react-router";
const items: BreadcrumbItem[] = [
{ label: "Accueil", href: "/" },
{ label: "Projets", href: "/projets" },
{ label: "SheenUI" },
];
export function Example() {
// Every link (inline and inside the "…" menu) renders as your router's Link.
return (
<Breadcrumb
items={items}
renderLink={(item) => <Link to={item.href!} />}
labels={{ nav: "Fil d'Ariane", more: (n) => `Afficher ${n} pages masquées` }}
/>
);
}Breadcrumb
BreadcrumbItem
Keyboard
Accessibility
- A <nav aria-label="Breadcrumb"> with an ordered list; the last item has aria-current="page". Give a second breadcrumb on the page its own labels.nav.
- Separators are hidden from assistive tech. An icon-only item keeps its label for screen readers.
- The "…" menu lists the hidden pages as real links.
All exports on this page
Breadcrumb— Where the current page sits in the hierarchy.defaultBreadcrumbLabels— The English strings of Breadcrumb ("Breadcrumb" for the landmark, "Show N hidden pages" for the "…" button).
When to use Breadcrumb
- Use it as a collapsible breadcrumb on a documentation or e-commerce page that sits several levels deep, such as Home, Products, Shoes, Running, so people can jump back to any ancestor without using the browser's Back button.
- Use maxItems with itemsBefore and itemsAfter for deeply nested file or category trees, where you always want the root and the current page visible and the middle folded into a menu.
- The collapse is measured before paint, so it suits responsive layouts where the same trail must fit a phone header and a wide desktop header without a flash of overflow.
- Skip it for linear multi-step flows such as checkout; Stepper shows progress and state there, and breadcrumbs describe site hierarchy rather than the order of tasks.
- Pair it with Navbar or Vertical nav for primary navigation, with Menu behavior already built in for the folded items, and with a page heading and Button actions below the trail.
Frequently asked questions
Related pages
67 components pages in all: browse them on All components.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .