Breadcrumb
Shows where the current page sits in the hierarchy and links back to each parent. It renders plain links and works with any router through asChild.
Installation
Add Breadcrumb to your project with the CK-UI CLI. It copies the source into your project, so the code is yours to change.
- Adds
Breadcrumb.tsxto your CK-UI folder (src/components/ck-ui by default)- Installs
@radix-ui/react-slotreact-iconsif your project does not have them yet
First time with CK-UI in this project? Run npx ck-ui-cli@latest init once before adding components. The installation guide explains what it sets up.
Manual installationInstall the packages and copy the files yourself.
Install the following dependencies
Run these commands in your terminal to install the required packages
Create or update your Breadcrumb component
Copy this code to create your Breadcrumb component
Test Your Component
- 1. Add the component to a test page
- 2. Check all props and variants work as expected
- 3. Verify responsive behavior
- 4. Test with different content/data
- 5. Ensure accessibility features work correctly
Router Links
Wrap your router's link with Breadcrumb.Link asChild, here Next.js Link in a nested docs trail.
With Icons
Icons go inside the link. An icon-only link needs visually hidden text. Pass children to Separator to change it.
Collapsed
For long trails, collapse the middle into Breadcrumb.Ellipsis inside a menu button, and truncate a long current page. The list also wraps rather than overflowing on narrow screens.
Accessibility
- Rendered as
<nav aria-label="Breadcrumb">around an ordered list, so it is a navigation landmark and the number of levels is announced. - The current page uses
Breadcrumb.Current:aria-current="page", not a link. - Separators are presentational list items with aria-hidden, so they are not read or counted.
Breadcrumb.Ellipsiscarries "More pages" for screen readers; when it opens a menu, put it inside a button with its own label.- Truncated labels keep their full text as the accessible name.
API Reference
Server-compatible, no router dependency. Import with import * as Breadcrumb from "@/components/ui/Breadcrumb".
Breadcrumb.Root
The nav landmark.
| Prop | Type | Default | Description |
|---|---|---|---|
aria-label | "string" | "Breadcrumb" | Landmark name. |
className | "string" | "undefined" | Additional classes, merged last. |
Breadcrumb.List
The ordered list. Wraps onto new lines when needed.
| Prop | Type | Default | Description |
|---|---|---|---|
className | "string" | "undefined" | Additional classes, merged last. |
Breadcrumb.Item
A list item.
| Prop | Type | Default | Description |
|---|---|---|---|
className | "string" | "undefined" | Additional classes, merged last. |
Breadcrumb.Link
A link to a parent page. Renders an <a>; other anchor attributes are passed through.
| Prop | Type | Default | Description |
|---|---|---|---|
href | "string" | "undefined" | Destination. |
asChild | "boolean" | "false" | Render your router's link instead of <a>. |
className | "string" | "undefined" | Additional classes, merged last. |
Breadcrumb.Current
The current page, with aria-current="page".
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | "boolean" | "false" | Render the single child element instead, merging this part's props and behaviour onto it. |
className | "string" | "undefined" | Additional classes, merged last. |
Breadcrumb.Separator
Decorative separator (a chevron by default).
| Prop | Type | Default | Description |
|---|---|---|---|
children | "ReactNode" | "chevron icon" | Custom separator. |
className | "string" | "undefined" | Additional classes, merged last. |
Breadcrumb.Ellipsis
Stands in for collapsed items.
| Prop | Type | Default | Description |
|---|---|---|---|
label | "string" | "More pages" | Screen-reader text. |
className | "string" | "undefined" | Additional classes, merged last. |
Used in these blocks
Block families with at least one block built on this component. Each page previews its blocks and lists the components and packages they use.