A compact navigation trail with truncation, semantic current page, and visible keyboard focus.
Components, tokens, and release notes in one place.
import {
Breadcrumb,
BreadcrumbList,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbPage,
BreadcrumbSeparator,
} from "@/components/ballmac/breadcrumb"
export default function BreadcrumbDemo() {
return (
<div className="w-full max-w-md rounded-xl border bg-card p-5 shadow-sm">
<Breadcrumb>
<BreadcrumbList>
<BreadcrumbItem>
<BreadcrumbLink href="#workspace">Workspace</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbLink href="#projects">Projects</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbPage>Design system</BreadcrumbPage>
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
<div className="mt-6 text-lg font-semibold">Design system</div>
<p className="mt-1 text-sm text-muted-foreground">
Components, tokens, and release notes in one place.
</p>
</div>
)
}Installation
$ pnpm dlx shadcn@latest add @ballmac/breadcrumbInstall the dependencies.
$ pnpm add lucide-reactAdd the Ballmac items it builds on.
$ pnpm dlx shadcn@latest add @ballmac/i18nCopy the source into your project.
components/ballmac/breadcrumb.tsx// Ballmac UI: Breadcrumb. https://ui.ballmac.com/components/breadcrumb // Based on shadcn/ui Breadcrumb (MIT, Copyright (c) 2023 shadcn), adding truncation and a keyboard-visible link treatment. "use client" import * as React from "react" import { ChevronRight, MoreHorizontal } from "lucide-react" import { cn } from "@/lib/utils" import { useMessages } from "@/lib/ballmac/i18n" type BreadcrumbProps = React.ComponentProps<"nav"> & { /** Accessible name of the navigation landmark. */ "aria-label"?: string } function Breadcrumb({ className, "aria-label": label, ...props }: BreadcrumbProps) { const msg = useMessages() label ??= msg("breadcrumb.label", "Breadcrumb") return ( <nav data-slot="breadcrumb" aria-label={label} className={cn("min-w-0", className)} {...props} /> ) } function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) { return ( <ol data-slot="breadcrumb-list" className={cn( "text-muted-foreground flex min-w-0 flex-wrap items-center gap-1.5 text-sm sm:gap-2.5", className, )} {...props} /> ) } function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) { return ( <li data-slot="breadcrumb-item" className={cn("inline-flex min-w-0 items-center gap-1.5", className)} {...props} /> ) } function BreadcrumbLink({ className, ...props }: React.ComponentProps<"a">) { return ( <a data-slot="breadcrumb-link" className={cn( "hover:text-foreground focus-visible:ring-ring/50 inline-block max-w-32 truncate rounded-sm outline-none transition-colors duration-150 focus-visible:ring-[3px] sm:max-w-52", className, )} {...props} /> ) } function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) { return ( <span data-slot="breadcrumb-page" aria-current="page" className={cn( "text-foreground inline-block max-w-40 truncate font-medium sm:max-w-64", className, )} {...props} /> ) } function BreadcrumbSeparator({ children, className, ...props }: React.ComponentProps<"li">) { return ( <li data-slot="breadcrumb-separator" role="presentation" aria-hidden="true" className={cn("text-muted-foreground [&>svg]:size-3.5", className)} {...props} > {children ?? <ChevronRight className="rtl:rotate-180"/>} </li> ) } function BreadcrumbEllipsis({ className, ...props }: React.ComponentProps<"span">) { const msg = useMessages() return ( <span data-slot="breadcrumb-ellipsis" className={cn( "flex size-6 items-center justify-center [&>svg]:size-4", className, )} {...props} > <MoreHorizontal aria-hidden="true" /> <span className="sr-only">{msg("breadcrumb.morePages", "More pages")}</span> </span> ) } export { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis, type BreadcrumbProps, }Update the import paths to match your project setup.
Usage
import { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis } from "@/components/ballmac/breadcrumb"The full example is in the Code tab above.
Examples
States and variants
import {
Breadcrumb,
BreadcrumbList,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbPage,
BreadcrumbSeparator,
BreadcrumbEllipsis,
} from "@/components/ballmac/breadcrumb"
export default function BreadcrumbStates() {
return (
<Breadcrumb className="w-full max-w-sm">
<BreadcrumbList>
<BreadcrumbItem>
<BreadcrumbLink href="#home">Home</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbEllipsis />
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbPage>September report</BreadcrumbPage>
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
)
}API reference
| Prop | Type | Default |
|---|---|---|
"aria-label"Accessible name of the navigation landmark. | string | — |
Also accepts the standard attributes of its root element.
Accessibility
| Key | Action |
|---|---|
| Tab | moves among breadcrumb links |
Use with AI
A compact navigation trail with truncation, semantic current page, and visible keyboard focus. With the shadcn MCP server set up (guide), ask your agent:
Add the Ballmac UI Breadcrumb (@ballmac/breadcrumb) to this project with the shadcn MCP, then use it where it fits.
Use it for
- Show a location inside a deep hierarchy
- Provide a way back to parent sections
Not for
- Use tabs for switching peer views
Registry JSON: https://ui.ballmac.com/r/breadcrumb.json
Credits
Based on shadcn/ui Breadcrumb, adapted by Ballmac. Free to use in personal and commercial projects.
- npm
- lucide-react
- Registry
- @ballmac/i18nshadcn/utils
Pairs well with
Pagination
A semantic page navigation set with current-page feedback, generous targets, and small-screen labels.
Animated Tabs
Radix Tabs with a pill or underline indicator that slides between triggers on a spring, and panels that fade in. Keeps full keyboard support and ARIA; controlled or uncontrolled.
Back To Top
A floating button that appears after scrolling, draws a progress ring, scrolls smoothly (instantly under reduced motion) and moves focus to the content.
Command Bar
A command palette with pages: a search-field style trigger, grouped commands, drill-in pages with a breadcrumb, Backspace to go back and a footer of key hints.