Breadcrumb

Web

Displays the path to the current resource using a hierarchy of links.

Installation

pnpm dlx cubix-ui@latest add breadcrumb

Usage

Import
import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
  BreadcrumbSeparator,
} from "@/components/cubix/breadcrumb"
Example
<Breadcrumb>
  <BreadcrumbList>
    <BreadcrumbItem>
      <BreadcrumbLink href="/">خانه</BreadcrumbLink>
    </BreadcrumbItem>
    <BreadcrumbSeparator />
    <BreadcrumbItem>
      <BreadcrumbLink href="/docs/components">کامپوننت‌ها</BreadcrumbLink>
    </BreadcrumbItem>
    <BreadcrumbSeparator />
    <BreadcrumbItem>
      <BreadcrumbPage>مسیر</BreadcrumbPage>
    </BreadcrumbItem>
  </BreadcrumbList>
</Breadcrumb>

Composition

Keep the last item as BreadcrumbPage so the current page is announced correctly. The default chevron flips in RTL.

Structure
Breadcrumb
└── BreadcrumbList
    ├── BreadcrumbItem
    │   └── BreadcrumbLink
    ├── BreadcrumbSeparator
    ├── BreadcrumbItem
    │   └── BreadcrumbLink
    ├── BreadcrumbSeparator
    └── BreadcrumbItem
        └── BreadcrumbPage

Accessibility

The root is a navigation landmark named مسیر by default. Override aria-label when the trail needs a more specific name. Separators are hidden from assistive technology, and the current page uses aria-current="page".

Examples

With icon

Place an icon inside BreadcrumbLink before the text. It is sized to 20px and spaced from the label automatically.

Separator

Pass a custom child to BreadcrumbSeparator to replace the default chevron.

Collapsed

Use BreadcrumbEllipsis to show a collapsed middle when the path is too long.

Dropdown

Compose BreadcrumbEllipsis with a DropdownMenu when the hidden segments should still be reachable.

Link component

Pass render={<Link />} to use your routing library's link. The docs adapter maps this to asChild on Radix.

API Reference

Note: Parts render data-slot attributes (breadcrumb, breadcrumb-list, breadcrumb-item, breadcrumb-link, breadcrumb-page, breadcrumb-separator, breadcrumb-ellipsis) for targeting in tests and parent selectors. Keep the last item as BreadcrumbPage. Use the same props on Base UI, React Aria, and Radix.

Breadcrumb

PropTypeDefaultDescription
aria-labelstring"مسیر"Accessible name for the navigation landmark.
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).
childrenReact.ReactNode-Usually a BreadcrumbList of items, separators, and the page.

BreadcrumbList

PropTypeDefaultDescription
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).

BreadcrumbItem

PropTypeDefaultDescription
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).

BreadcrumbLink

PropTypeDefaultDescription
hrefstring-Destination for the default anchor. Ignored when render is set.
renderReact.ReactElement-Base UI / React Aria: render the link as another element, such as a Next.js Link.
asChildboolean-Radix: merge props onto the child element instead of rendering an anchor.
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).

BreadcrumbPage

PropTypeDefaultDescription
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).
childrenReact.ReactNode-The current page label. Not a link.

BreadcrumbSeparator

PropTypeDefaultDescription
childrenReact.ReactNode-Custom separator. Defaults to a chevron when omitted.
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).

BreadcrumbEllipsis

PropTypeDefaultDescription
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).