Application
Breadcrumbs
Accessible breadcrumb trail with chevron separators and an optional leading icon.
Motionnone
Install
Install Kineto and follow the theme setup once in your app.
bash
npm install kinetotsx
import { Breadcrumbs } from "kineto/breadcrumbs";Preview
tsx
import * as React from "react";
import { ChevronRight } from "lucide-react";
import { cn } from "@/lib/cn";
export interface BreadcrumbItem {
label: React.ReactNode;
href?: string;
icon?: React.ReactNode;
}
export interface BreadcrumbsProps extends React.HTMLAttributes<HTMLElement> {
items: BreadcrumbItem[];
}
const Breadcrumbs = React.forwardRef<HTMLElement, BreadcrumbsProps>(
({ className, items, ...props }, ref) => (
<nav ref={ref} aria-label="Breadcrumb" className={cn("flex", className)} {...props}>
<ol className="flex flex-wrap items-center gap-1.5 text-sm">
{items.map((item, i) => {
const last = i === items.length - 1;
return (
<li key={i} className="flex items-center gap-1.5">
{item.href && !last ? (
<a
href={item.href}
className="inline-flex items-center gap-1.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
>
{item.icon}
{item.label}
</a>
) : (
<span
aria-current={last ? "page" : undefined}
className={cn(
"inline-flex items-center gap-1.5 px-1",
last ? "font-medium text-foreground" : "text-muted-foreground"
)}
>
{item.icon}
{item.label}
</span>
)}
{!last ? (
<ChevronRight className="size-4 shrink-0 text-muted-foreground/50" />
) : null}
</li>
);
})}
</ol>
</nav>
)
);
Breadcrumbs.displayName = "Breadcrumbs";
export { Breadcrumbs };src/components/ui/breadcrumbs.tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| items | { label; href?; icon? }[] | — | Trail items; the last is the current page. |