Skip to documentation
Design system / Sources & standards
Current repository source
breadcrumbTrail.tsx
src/components/navigation/breadcrumbTrail.tsx
This view contains the escaped source read during the deployment build. Code and policy text are unchanged. Markdown is shown as source, not rendered as a document. A new deployment refreshes the content.
import { Fragment } from "react";
import Link from "next/link";
import { ChevronRight } from "lucide-react";
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
} from "@/components/ui/breadcrumb";
import type { BreadcrumbItem as BreadcrumbItemType } from "./types";
import { cn } from "@/lib/utils";
type BreadcrumbTrailProps = {
items: BreadcrumbItemType[];
className?: string;
};
export function BreadcrumbTrail({ items, className }: BreadcrumbTrailProps) {
return (
<Breadcrumb className={cn("min-w-0 overflow-x-auto overscroll-x-contain", className)}>
<BreadcrumbList className="w-max flex-nowrap whitespace-nowrap p-1">
{items.map((item, index) => (
<Fragment key={`${item.label}-${item.href ?? "current"}`}>
{index > 0 ? <BreadcrumbSeparator><ChevronRight /></BreadcrumbSeparator> : null}
<BreadcrumbItem className="shrink-0">
{item.href && !item.isCurrent ? (
<BreadcrumbLink asChild>
<Link href={item.href}>{item.label}</Link>
</BreadcrumbLink>
) : (
<BreadcrumbPage>{item.label}</BreadcrumbPage>
)}
</BreadcrumbItem>
</Fragment>
))}
</BreadcrumbList>
</Breadcrumb>
);
}
All sources and standards