Breadcrumb
Path navigation with separators and overflow collapse.
Built on Icons.
Environment variables
12 variables across Production, Preview and Development.
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/breadcrumb.jsonUsage
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
} from "@/components/ui/breadcrumb"
<Breadcrumb>
<BreadcrumbList>
<BreadcrumbItem>
<BreadcrumbLink href="/projects">Projects</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbPage>Settings</BreadcrumbPage>
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>Examples
Collapsed trail
With maxItems, the first item and the last few stay and the middle folds into an ellipsis. Clicking it expands the trail in place.
File path
Slash separators, a mono font and asChild buttons. Moving deeper or back up collapses the trail again once it outgrows maxItems.
API reference
Breadcrumb
Renders a nav labelled "Breadcrumb" and accepts every native attribute.
| Prop | Type | Default |
|---|---|---|
maxItems | numberCollapse the trail when it has more items than this (minimum 2). The first item and the last maxItems − 1 stay visible. | None |
color | NeonColorPalette name or hex. Falls back to --neon-accent, then cyan. | inherited |
aria-label | stringName of the navigation landmark. | "Breadcrumb" |
BreadcrumbList
Renders an ol that wraps on narrow screens. Put BreadcrumbItem and BreadcrumbSeparator directly inside it (fragments are fine) so it can collapse them.
| Prop | Type | Default |
|---|---|---|
className | stringClasses for the list, e.g. a mono font for paths. | None |
BreadcrumbItem
Renders an li around one link or the current page.
| Prop | Type | Default |
|---|---|---|
className | stringClasses for the list item. | None |
BreadcrumbLink
Renders an a. Icons inside are sized to the text.
| Prop | Type | Default |
|---|---|---|
href | stringWhere the crumb goes. | None |
asChild | booleanMerge the link styles onto the single child, such as your router's Link or a button. | false |
BreadcrumbPage
The current page. Renders a span with aria-current="page".
| Prop | Type | Default |
|---|---|---|
className | stringClasses for the span. | None |
BreadcrumbSeparator
Renders a presentational li, hidden from screen readers.
| Prop | Type | Default |
|---|---|---|
children | ReactNodeReplaces the chevron, e.g. a slash. | chevron |
BreadcrumbEllipsis
The button that maxItems renders. Exported for building your own overflow, e.g. as a menu trigger.
| Prop | Type | Default |
|---|---|---|
aria-label | stringAccessible name for the icon button. | "Show more" |
children | ReactNodeReplaces the icon. | ellipsis icon |
Accessibility
- The trail is an ordered list inside a nav landmark named "Breadcrumb".
- The current page carries aria-current="page" and is not a link.
- Separators are presentational and hidden from screen readers, so the list reads as its links only.
- The collapse button is named for what it reveals, such as "Show 3 more items". After expanding, focus moves to the first revealed link.
- Revealed items slide in with a short stagger; with reduced motion they appear at once.