Breadcrumbs
A breadcrumb trail for the org, project and environment you are in, collapsing on narrow screens.
const items = [
{ label: "acme", href: "/acme" },
{ label: "robin", href: "/acme/robin" },
{ label: "production", href: "/acme/robin/production" },
{ label: "eu-west", href: "/acme/robin/production/eu-west" },
{ label: "Logs" },
];
<Breadcrumbs items={items} maxItems={3} />Props
Installation
npx shadcn@latest add https://sproutboat.com/ikada/r/breadcrumbs.jsonThe CLI writes components/ikada/breadcrumbs.tsx and merges the ikada theme into your CSS. It also installs the components it is built from: Dropdown Menu. Or take it from the package: import { Breadcrumbs } from "@sproutboat/ikada";
Usage
import { Breadcrumbs } from "@/components/ikada/breadcrumbs";
const items = [
{ label: "acme", href: "/acme" },
{ label: "robin", href: "/acme/robin" },
{ label: "production", href: "/acme/robin/production" },
{ label: "eu-west", href: "/acme/robin/production/eu-west" },
{ label: "Logs" },
];
<Breadcrumbs items={items} maxItems={3} />Examples
<Breadcrumbs
items={[
{ label: "acme", href: "/acme" },
{ label: "robin", href: "/acme/robin" },
{ label: "Logs" },
]}
/>const items = [
{ label: "acme", href: "/acme" },
{ label: "robin", href: "/acme/robin" },
{ label: "production", href: "/acme/robin/production" },
{ label: "eu-west", href: "/acme/robin/production/eu-west" },
{ label: "Logs" },
];
<Breadcrumbs items={items} />const items = [
{ label: "acme", href: "/acme" },
{ label: "robin", href: "/acme/robin" },
{ label: "production", href: "/acme/robin/production" },
{ label: "eu-west", href: "/acme/robin/production/eu-west" },
{ label: "Logs" },
];
<Breadcrumbs items={items} maxItems={5} />Props
| Prop | Type | Description |
|---|---|---|
| itemsrequired | readonly BreadcrumbItem[] | Root first (Org, Project, Environment). The last item is the current page. |
| maxItems | number | Past this many, the middle items collapse into a menu. The first and last always show. Default `4`. |
Also takes every prop of Omit<ComponentProps<"nav">, "children">.
Source: src/components/breadcrumbs.tsx