---
title: Breadcrumb
description: Breadcrumbs show where the current page sits in a hierarchy. They help users backtrack without relying on the browser history alone.
---

import { meta as BreadcrumbMeta, Default } from '@/content/stories/breadcrumb';
import Canvas from '@/components/component-docs/canvas';
import Demo from '@/components/component-docs/demo';

export const config = {
	dependencies: {
		components: [Canvas, Demo],
		scripts: [
			'../../../components/component-docs/demo.script.tsx',
			'../../../components/component-docs/canvas.script.tsx',
			'../../../components/component-docs/controls.script.tsx',
		],
	},
};


# Breadcrumb

<p class="docs-lede">Breadcrumbs show where the current page sits in a hierarchy. They help users backtrack without relying on the browser history alone.</p>

## Try it

<Demo of={Default} meta={BreadcrumbMeta} />

## Usage

Compose the trail with `RuiBreadcrumbList`, `RuiBreadcrumbItem`, `RuiBreadcrumbLink`, and `RuiBreadcrumbPage` for the current location.

```tsx
import {
  RuiBreadcrumb,
  RuiBreadcrumbList,
  RuiBreadcrumbItem,
  RuiBreadcrumbLink,
  RuiBreadcrumbPage,
  RuiBreadcrumbSeparator,
} from '@ecopages/radiant-ui/breadcrumb';

<RuiBreadcrumb label="Breadcrumb">
  <RuiBreadcrumbList>
    <RuiBreadcrumbItem><RuiBreadcrumbLink href="/">Home</RuiBreadcrumbLink></RuiBreadcrumbItem>
    <RuiBreadcrumbSeparator />
    <RuiBreadcrumbItem><RuiBreadcrumbLink href="/components/button">Components</RuiBreadcrumbLink></RuiBreadcrumbItem>
    <RuiBreadcrumbSeparator />
    <RuiBreadcrumbItem><RuiBreadcrumbPage>Breadcrumb</RuiBreadcrumbPage></RuiBreadcrumbItem>
  </RuiBreadcrumbList>
</RuiBreadcrumb>
```

## Mark the current page

<p>The last item should use `RuiBreadcrumbPage`, not a link. Earlier segments link to ancestor routes.</p>

## Truncate long trails

<p>When the hierarchy is deep, collapse middle segments with `RuiBreadcrumbEllipsis` and expose the full path on demand.</p>

## Theming

Breadcrumb roles map to **semantic surface + link roles**, never Tailwind palette steps:

| Part | CSS roles |
| --- | --- |
| List / items | `on-background` text |
| Links | `primary` color, hover underline |
| Current page | `on-background`, `font-medium` |
| Separator / ellipsis | `on-surface` (receded) |

Check the compiled `breadcrumb.css` for the exact roles. Override at the theme layer, not in component CSS.

## Accessibility

- The root element renders as a `nav` landmark with an accessible name from the `label` prop.
- The current page is indicated with `aria-current="page"`.
- Separators are hidden from assistive technologies with `aria-hidden`.

## API

`RuiBreadcrumb` is a custom element (`<rui-breadcrumb>`) rendering a `<nav>` landmark; the trail is authored light-DOM children via the view helpers.

### Attributes (`<rui-breadcrumb>`)

| Attribute | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` | `Breadcrumb` | Accessible name for the navigation landmark. |
| `separator` | `string` | `/` | Glyph used by empty `RuiBreadcrumbSeparator` nodes. |

### View helpers

| Component | Target stamped | Notes |
| --- | --- | --- |
| `RuiBreadcrumb` | `<nav class="rui-breadcrumb">` | Sets `separator` CSS variable. |
| `RuiBreadcrumbList` | `<ol class="rui-breadcrumb__list">` | Ordered list of crumbs. |
| `RuiBreadcrumbItem` | `<li class="rui-breadcrumb__item">` | Wraps a link or page. |
| `RuiBreadcrumbLink` | `<a class="rui-breadcrumb__link">` | Linked ancestor. |
| `RuiBreadcrumbPage` | `<span aria-current="page">` | Current page (non-link). |
| `RuiBreadcrumbSeparator` | `<li aria-hidden>` | Presentational separator. |
| `RuiBreadcrumbEllipsis` | `<span aria-hidden>` | Collapsed middle segment. |

No light-DOM query contract — the host does not coordinate authored children.

### CSS classes

Public BEM classes (documented via `@cssclass`):

| Class | Description |
| --- | --- |
| `.rui-breadcrumb` | `<nav>` landmark root. |
| `.rui-breadcrumb__list` | Ordered list row. |
| `.rui-breadcrumb__item` | List item wrapping a crumb link/page. |
| `.rui-breadcrumb__link` | Crumb link. |
| `.rui-breadcrumb__page` | Current page span. |
| `.rui-breadcrumb__separator` | Presentational separator. |
| `.rui-breadcrumb__ellipsis` · `.rui-breadcrumb__ellipsis-label` | Collapsed segment indicator + label. |

### Theme roles

| Part | CSS variables consumed |
| --- | --- |
| Links | `--primary` |
| Separator / ellipsis | `--on-surface` |
