Breadcrumb
Breadcrumb with thoughtful defaults, semantic styling, and editable source.
Make it yours.
Install the editable source and its dependencies into your React + Tailwind project.
Scroll horizontally for long lines
pnpm dlx shadcn@4.0.8 add http://localhost:3000/r/breadcrumb.jsonUse it
Scroll horizontally for long lines
"use client";
import {Breadcrumb} from '@/components/jez-ui/ui/breadcrumb';
export default function Example(){
return <><Breadcrumb items={[{label:'Library',href:'/components'},{label:'Foundations',href:'/components?category=foundations'},{label:'Breadcrumb'}]}/></>;
}Props & types
Scroll horizontally for long lines
{
items: { label: string; href?: string }[];
className?: string;
}Source
View 2 source files
registry/ui/breadcrumb.tsx
Scroll horizontally for long lines
"use client";
import * as React from "react";
import { cn } from "./utils";
export function Breadcrumb({
items,
className,
}: {
items: { label: string; href?: string }[];
className?: string;
}) {
return (
<nav aria-label="Breadcrumb" className={cn("text-sm", className)}>
<ol className="flex flex-wrap gap-2">
{items.map((i, n) => (
<li key={n} className="flex gap-2">
{n > 0 && (
<span aria-hidden="true" className="text-muted-foreground">
/
</span>
)}
{i.href ? (
<a
href={i.href}
className="text-muted-foreground hover:text-foreground"
>
{i.label}
</a>
) : (
<span aria-current="page">{i.label}</span>
)}
</li>
))}
</ol>
</nav>
);
}
registry/ui/utils.ts
Scroll horizontally for long lines
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...values: ClassValue[]) {
return twMerge(clsx(values));
}
Dependencies
clsx@2.1.1 · tailwind-merge@3.5.0
Accessibility & behaviour
Provide meaningful labels and preserve keyboard focus styles. Check contrast when customising theme colours.
Read the accessibility and performance guide →