Skip to content

Breadcrumbs

A navigation component that shows the current page's location within a navigational hierarchy. On mobile, intermediate items automatically collapse to an ellipsis when there are more than two items in the trail.

Source Code

import ilha from "ilha";
import { House, Folder } from "lucide";
import { Breadcrumbs, Icon } from "areia";

export default ilha.render(() => (
  <Breadcrumbs
    items={[
      {
        href: "/",
        children: "Home",
        icon: <Icon icon={House} />,
      },
      {
        href: "/projects",
        children: "Projects",
        icon: <Icon icon={Folder} />,
      },
      { children: "Current Project" },
    ]}
  />
));

Import

import { Breadcrumbs } from "areia";

Usage

Use children for composition-first breadcrumbs, or pass an items array for the convenient data-driven shortcut. With items, the last item is automatically treated as the current page — it renders without a link and receives aria-current="page".

import ilha from "ilha";
import { Breadcrumbs } from "areia";

export default ilha.render(() => (
  <Breadcrumbs
    items={[
      { href: "/", children: "Home" },
      { href: "/docs", children: "Docs" },
      { children: "Breadcrumbs" },
    ]}
  />
));

Examples

Basic

A simple three-level breadcrumb trail.

import ilha from "ilha";
import { Breadcrumbs } from "areia";

export default ilha.render(() => (
  <Breadcrumbs
    items={[
      { href: "/", children: "Home" },
      { href: "/docs", children: "Docs" },
      { children: "Breadcrumbs" },
    ]}
  />
));

Sizes

Two sizes are available: sm for compact UIs and base for the default appearance.

import ilha from "ilha";
import { Breadcrumbs } from "areia";

export default ilha.render(() => (
  <div class="flex flex-col gap-8">
    <Breadcrumbs
      size="sm"
      items={[
        { href: "/", children: "Home" },
        { href: "/docs", children: "Docs" },
        { children: "Small Breadcrumbs" },
      ]}
    />
    <Breadcrumbs
      size="base"
      items={[
        { href: "/", children: "Home" },
        { href: "/docs", children: "Docs" },
        { children: "Base Breadcrumbs" },
      ]}
    />
  </div>
));

With Icons

Each item accepts an optional icon prop. Use the Icon component with any Lucide icon to add context to the trail.

import ilha from "ilha";
import { House, Folder } from "lucide";
import { Breadcrumbs, Icon } from "areia";

export default ilha.render(() => (
  <Breadcrumbs
    items={[
      {
        href: "/",
        children: "Home",
        icon: <Icon icon={House} />,
      },
      {
        href: "/projects",
        children: "Projects",
        icon: <Icon icon={Folder} />,
      },
      { children: "Current Project" },
    ]}
  />
));

Loading

Set loading to true to replace the current page label with a pulsing skeleton placeholder while data is being fetched.

import ilha from "ilha";
import { House } from "lucide";
import { Breadcrumbs, Icon } from "areia";

export default ilha.render(() => (
  <Breadcrumbs
    loading
    items={[
      {
        href: "/",
        children: "Home",
        icon: <Icon icon={House} />,
      },
      { href: "/docs", children: "Docs" },
      { children: "Loading..." },
    ]}
  />
));

Clipboard

Provide a copyUrl to show a copy-to-clipboard button that appears on hover. After copying, a checkmark is displayed for two seconds.

import ilha from "ilha";
import { Breadcrumbs } from "areia";

export default ilha.render(() => (
  <Breadcrumbs
    items={[
      { href: "/", children: "Home" },
      { href: "/docs", children: "Docs" },
      { children: "Current Page" },
    ]}
    copyUrl="https://example.com/docs/current-page"
  />
));

Composition

Use Breadcrumbs.Link, Breadcrumbs.Separator, and Breadcrumbs.Current as children when you want React-style JSX composition. This bypasses the automatic mobile ellipsis generated by the items shortcut.

import ilha from "ilha";
import { Breadcrumbs } from "areia";

export default ilha.render(() => (
  <Breadcrumbs copyUrl="https://example.com/docs/current-page">
    <Breadcrumbs.Link href="/">Home</Breadcrumbs.Link>
    <Breadcrumbs.Separator />
    <Breadcrumbs.Link href="/docs">Docs</Breadcrumbs.Link>
    <Breadcrumbs.Separator />
    <Breadcrumbs.Current>Current Page</Breadcrumbs.Current>
  </Breadcrumbs>
));

API Reference

PropTypeDefaultDescription
itemsBreadcrumbItem[]Breadcrumb trail items. The last item is treated as the current page.
childrenunknownComposed breadcrumb markup. Takes priority over items.
size"sm" | "base""base"Controls the overall size of the breadcrumbs.
loadingbooleanfalseWhen true, the current page label is replaced with a loading skeleton.
copyUrlstringWhen provided, a copy-to-clipboard button appears on hover.
classstringAdditional CSS classes merged via cn().
classNamestringAlias for class.
PropTypeDefaultDescription
hrefstringLink target URL. Omit for the current (last) item.
childrenunknownDisplay content for the breadcrumb item.
iconunknownIcon rendered before the label.

Breadcrumbs.Root and Breadcrumbs.Static are aliases for the base breadcrumb renderer.

PropTypeDefaultDescription
hrefstringLink target URL.
childrenunknownContent rendered inside the link.
iconunknownIcon rendered before the label.
classstringAdditional CSS classes.
classNamestringAlias for class.
PropTypeDefaultDescription
childrenunknownLabel for the current page.
iconunknownIcon rendered before the label.
loadingbooleanWhen true, shows a loading skeleton instead of the label.
classstringAdditional CSS classes.
classNamestringAlias for class.

No component-specific props. Renders a chevron SVG separator.

PropTypeDefaultDescription
textstringThe text to copy to the clipboard.
classstringAdditional CSS classes.
classNamestringAlias for class.