Navigation
Breadcrumbs
Free15.3 KB gzippedA trail of links showing where the current page sits in the site hierarchy. Compose with Breadcrumbs.Item.
Accessibility: WCAG 2.2 AA · No A or AA violations in light or dark mode · Keys: Tab · Full report
Import
import { Breadcrumbs } from "@vjdesigns/vjdesigns-ui";
Importing only Breadcrumbs adds about 15.3 KB of minified, gzipped JavaScript to your app (React not included). The stylesheet is shared by every component and loaded once: 75.1 KB gzipped.
Examples
Basic
The last item is the current page: it gets aria-current="page" and isn't a link.
import { Breadcrumbs, HomeIcon } from "@vjdesigns/vjdesigns-ui";
export function Basic() {
return (
<Breadcrumbs>
<Breadcrumbs.Item href="#example-basic" icon={<HomeIcon />}>
Home
</Breadcrumbs.Item>
<Breadcrumbs.Item href="#example-basic">Projects</Breadcrumbs.Item>
<Breadcrumbs.Item href="#example-basic">Spring launch</Breadcrumbs.Item>
<Breadcrumbs.Item>Settings</Breadcrumbs.Item>
</Breadcrumbs>
);
}
Collapsed
Past maxItems, the middle collapses into a button that expands the full trail.
import { Breadcrumbs } from "@vjdesigns/vjdesigns-ui";
export function Collapsed() {
return (
<Breadcrumbs maxItems={4} itemsBeforeCollapse={1} itemsAfterCollapse={2} size="sm">
<Breadcrumbs.Item href="#example-collapsed">Home</Breadcrumbs.Item>
<Breadcrumbs.Item href="#example-collapsed">Clothing</Breadcrumbs.Item>
<Breadcrumbs.Item href="#example-collapsed">Men</Breadcrumbs.Item>
<Breadcrumbs.Item href="#example-collapsed">Shoes</Breadcrumbs.Item>
<Breadcrumbs.Item href="#example-collapsed">Running</Breadcrumbs.Item>
<Breadcrumbs.Item>Trail runners</Breadcrumbs.Item>
</Breadcrumbs>
);
}
Accessibility
Breadcrumbs are a navigation landmark named by aria-label, and the last item is marked aria-current="page". With maxItems, the middle levels collapse into a named "show more" button that keyboard and screen reader users can open.
import { Breadcrumbs, HomeIcon } from "@vjdesigns/vjdesigns-ui";
export function Accessibility() {
return (
<Breadcrumbs aria-label="Breadcrumb" maxItems={3}>
<Breadcrumbs.Item href="#example-accessibility" icon={<HomeIcon />}>
Home
</Breadcrumbs.Item>
<Breadcrumbs.Item href="#example-accessibility">Shop</Breadcrumbs.Item>
<Breadcrumbs.Item href="#example-accessibility">Shoes</Breadcrumbs.Item>
<Breadcrumbs.Item href="#example-accessibility">Running</Breadcrumbs.Item>
<Breadcrumbs.Item current>Trail runners</Breadcrumbs.Item>
</Breadcrumbs>
);
}
Translated
The collapse button's name comes from the locale (Japanese here). Translate the landmark's aria-label and the item labels yourself.
import { Breadcrumbs, LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import ja from "@vjdesigns/vjdesigns-ui/locales/ja";
export function Translated() {
return (
<LocaleProvider locale="ja" messages={ja}>
<Breadcrumbs aria-label="現在地" maxItems={3}>
<Breadcrumbs.Item href="#example-translated">ホーム</Breadcrumbs.Item>
<Breadcrumbs.Item href="#example-translated">ショップ</Breadcrumbs.Item>
<Breadcrumbs.Item href="#example-translated">靴</Breadcrumbs.Item>
<Breadcrumbs.Item current>ランニングシューズ</Breadcrumbs.Item>
</Breadcrumbs>
</LocaleProvider>
);
}
Right to left
The first example again, inside a right-to-left LocaleProvider (Arabic). Layout, spacing and arrow icons mirror, and the components' built-in text is translated. The example's own text stays in English.
Basic
import { LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import ar from "@vjdesigns/vjdesigns-ui/locales/ar";
// Basic is the "Basic" example above.
<LocaleProvider locale="ar" messages={ar}>
<Basic />
</LocaleProvider>
API reference
Breadcrumbs
| Prop | Type | Default |
|---|---|---|
children
| ReactNode | — |
aria-labelAccessible name of the | string | "Breadcrumb" |
sizeType size, spacing, and separator size. | "sm""md""lg" | "md" |
separatorDecorative separator shown between items (e.g. | ReactNode | — |
linkAsComponent used for every item's link, such as a React Router or Next.js | ElementType | — |
maxItemsWhen there are more items than this, the middle ones collapse into a "show more" button. Leave unset to never collapse. | number | — |
itemsBeforeCollapseItems kept visible before the collapsed group. | number | 1 |
itemsAfterCollapseItems kept visible after the collapsed group. Values below 1 are treated as 1, so the current page stays visible. | number | 1 |
expandedControlled expanded state of a collapsed trail. | boolean | — |
defaultExpandedInitial expanded state when uncontrolled. | boolean | false |
onExpandedChangeCalled with the new expanded state when the collapsed items are revealed. | (expanded: boolean) => void | — |
expandLabelAccessible name of the expand button, given the number of hidden items. Localize it here. | (hiddenCount: number) => string | (n) => `Show ${n} more breadcrumbs` |
Also accepts native <nav> attributes, plus className, style and ref.
Breadcrumbs.Item
One step in the trail. See BreadcrumbItem.
| Prop | Type | Default |
|---|---|---|
childrenThe visible label. | ReactNode | — |
aria-labelOverrides the accessible name. Usually unnecessary when there is a visible label. | string | — |
hrefDestination URL. Omit it (and | string | — |
asComponent used for this item's link, such as a router | ElementType | — |
linkPropsExtra props for the link element, typed for | Partial<Omit<ComponentPropsWithRef<C>, "children" | "className">> | — |
iconIcon before the label (e.g. | ReactNode | — |
currentMarks this item as the current page: it renders as text with | boolean | — |
titleTooltip text. When a label truncates, its full text is shown as a tooltip automatically. | string | — |
Also accepts native <li> attributes, plus className, style and ref.
See what changed in each version in the Changelog.
Accessibility report
Breadcrumbs targets WCAG 2.2 AA. Below: a live axe-core audit of this page's examples, Lighthouse scores for the page in both modes, the accessibility behavior built into the component, and the checks only a person can do.
axe-core audit (live)
Checking the examples above…
Lighthouse audit
Light mode
Score 10035 passed · 0 failed · 30 not applicable · 10 to check by hand
Dark mode
Score 10035 passed · 0 failed · 30 not applicable · 10 to check by hand
Lighthouse 13.5.0 audits the whole docs page (header and sidebar included), not just the examples, in English. Last run 11/27/2026. Some failed audits carry no weight in the score, so a page can score 100 and still list one.
Built-in behavior
Keyboard
| Key | Action |
|---|---|
| Tab | Moves through the links. The current page isn't a link. |
Roles and states
| Element | Role | States and properties |
|---|---|---|
<nav> | navigation | aria-label ("Breadcrumb") |
<ol> | list | — |
| Current page | none | aria-current="page" |
| Separators | none | aria-hidden="true" |
Manual checks
Automated tools find roughly a third of accessibility issues. Test these in your app, with your content.
| Check | What to test | WCAG 2.2 |
|---|---|---|
| Keyboard | Every action works with Tab, Shift+Tab, Enter, Space and the arrow keys, and focus never gets stuck. | 2.1.1 (A), 2.1.2 (A) |
| Focus | Focus moves in a logical order, is always visible, and isn't hidden behind sticky headers. | 2.4.3 (A), 2.4.7 (AA), 2.4.11 (AA), 2.4.13 (AAA) |
| Screen readers | Names, roles and states are announced correctly, and status changes are announced without moving focus. | 1.3.1 (A), 4.1.2 (A), 4.1.3 (AA) |
| Color | Meaning never depends on color alone; your own colors meet contrast in both modes. | 1.4.1 (A), 1.4.3 (AA), 1.4.11 (AA), 1.4.6 (AAA) |
| Zoom and reflow | At 200% text size and at 320px wide (400% zoom), nothing is cut off and no sideways scrolling is needed. | 1.4.4 (AA), 1.4.10 (AA), 1.4.12 (AA) |
| Pointer targets | Click and tap targets are at least 24×24px (44×44px for AAA), or spaced so they don't overlap. | 2.5.8 (AA), 2.5.5 (AAA) |
| Motion | Animations respect the reduced-motion setting. | 2.3.3 (AAA) |