Path
Breadcrumb navigation showing page hierarchy.
import { Path } from "ui-lab-components";
export function Example() {
return (
<Path>
<Path.Item href="/">Home</Path.Item>
<Path.Item href="/products">Products</Path.Item>
<Path.Item>Electronics</Path.Item>
</Path>
);
}Basic Path
A simple path navigation showing the current page location.
import { Path } from 'ui-lab-components';
export const metadata = {
title: 'Basic Path',
description: 'A simple path navigation showing the current page location. Use this to help users understand their position in the site hierarchy.'
};
export default function Example() {
return (
<Path>
<Path.Item href="/">Home</Path.Item>
<Path.Item href="/products">Products</Path.Item>
<Path.Item href="/products/electronics">Electronics</Path.Item>
<Path.Item>Laptop</Path.Item>
</Path>
);
}
Custom Separator
Pass any node via the separator prop to replace the default slash.
import { Path } from "ui-lab-components";
import { FaChevronRight } from "react-icons/fa6";
export const metadata = {
title: "Custom Separator",
description: "Pass any node via the separator prop to replace the default slash.",
};
export default function Example() {
return (
<Path separator={<FaChevronRight className="w-3 h-3 text-foreground-400" />}>
<Path.Item href="/projects">Projects</Path.Item>
<Path.Item href="/projects/ui-lab">ui-lab</Path.Item>
<Path.Item>components</Path.Item>
</Path>
);
}
Collapsed Breadcrumb
Deep paths collapse intermediate crumbs into an ellipsis menu — Path.Item wraps the Menu trigger directly.
import { Path, Menu, Button } from "ui-lab-components";
import { FaEllipsis } from "react-icons/fa6";
export const metadata = {
title: "Collapsed Breadcrumb",
description: "Deep paths collapse intermediate crumbs into an ellipsis menu — Path.Item wraps the Menu trigger directly.",
};
const collapsed = [
{ label: "Projects", href: "/projects" },
{ label: "ui-lab", href: "/projects/ui-lab" },
{ label: "packages", href: "/projects/ui-lab/packages" },
];
export default function Example() {
return (
<Path>
<Path.Item href="/">Home</Path.Item>
<Path.Item>
<Menu type="pop-over">
<Menu.Trigger>
<Button icon={<FaEllipsis />} styles="p-2" size="icon" variant="ghost" aria-label="Show collapsed path" />
</Menu.Trigger>
<Menu.Content align="start">
{collapsed.map((crumb) => (
<Menu.Item key={crumb.href} onSelect={() => {}}>
{crumb.label}
</Menu.Item>
))}
</Menu.Content>
</Menu>
</Path.Item>
<Path.Item href="/projects/ui-lab/packages/@ui">@ui</Path.Item>
<Path.Item>Path.tsx</Path.Item>
</Path>
);
}