When to use it#
- Use it at the top of a page that sits two or more levels below the start page: a topic page, a service page, an article.
- Put it before
<main>, not in it, and give it a different name from any other<nav>on the page. - Put it in the same place on every page that has one. People look for it there (3.2.3 Consistent Navigation, AA).
- List every level from the start page to the parent of the current page. It never collapses into “…”: a hidden level is a hidden way out, so a long trail wraps.
- Not for the main menu: use Navigation. Not for moving between pages of a list: use Pagination. Not on the start page, which has no level above it.
Example#
import { Breadcrumb } from '@kvirn-ui/react'
import { useBreadcrumbTexts } from './texts.ts'
export function DefaultBreadcrumb() {
const { texts } = useBreadcrumbTexts()
return (
<Breadcrumb.Root label={texts.defaultLabel}>
<Breadcrumb.List>
<Breadcrumb.Item>
<Breadcrumb.Link href="#start">{texts.start}</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Item>
<Breadcrumb.Link href="#children">{texts.children}</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Item>
<Breadcrumb.Current>{texts.preschool}</Breadcrumb.Current>
</Breadcrumb.Item>
</Breadcrumb.List>
</Breadcrumb.Root>
)
}Information: Implement like this
Register your router’s link once on the provider and every Breadcrumb.Link is rendered by it, so a click doesn’t reload the page. See the Next.js setup on KvirnProvider.
Use cases#
A page deep in the structure
A service page can sit five or six levels down. Write every level as a Breadcrumb.Link and the page you are on as Breadcrumb.Current. The trail wraps onto more lines instead of hiding the middle, so every way up stays visible, also on a screen 320px wide.
import { Breadcrumb } from '@kvirn-ui/react'
import { useBreadcrumbTexts } from './texts.ts'
export function LongTrail() {
const { texts } = useBreadcrumbTexts()
return (
<Breadcrumb.Root label={texts.longLabel}>
<Breadcrumb.List>
<Breadcrumb.Item>
<Breadcrumb.Link href="#start">{texts.start}</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Item>
<Breadcrumb.Link href="#services">{texts.services}</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Item>
<Breadcrumb.Link href="#social">{texts.social}</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Item>
<Breadcrumb.Link href="#home-care">{texts.homeCare}</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Item>
<Breadcrumb.Link href="#home-care-help">{texts.homeCareHelp}</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Item>
<Breadcrumb.Current>{texts.homeCareApply}</Breadcrumb.Current>
</Breadcrumb.Item>
</Breadcrumb.List>
</Breadcrumb.Root>
)
}Warning: Don't forget
Name each link after the page’s title, as the page’s own heading says it: “Home care”, not “Click here” or “Level 3”. Mark no other item as the current page.
Your own name for the trail
In English the trail is named “You are here” by default. Give it another name with label when your service uses other words, or when the page has another navigation with that name. A screen reader lists landmarks by name, so two with the same name can’t be told apart.
import { Breadcrumb } from '@kvirn-ui/react'
import { useBreadcrumbTexts } from './texts.ts'
export function OwnLabel() {
const { texts } = useBreadcrumbTexts()
return (
<Breadcrumb.Root label={texts.ownLabel}>
<Breadcrumb.List>
<Breadcrumb.Item>
<Breadcrumb.Link href="#start">{texts.start}</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Item>
<Breadcrumb.Link href="#services">{texts.services}</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Item>
<Breadcrumb.Current>{texts.homeCareFees}</Breadcrumb.Current>
</Breadcrumb.Item>
</Breadcrumb.List>
</Breadcrumb.Root>
)
}Props in this example:
labelon Breadcrumb.Root
Warning: Don't forget
A name you write is your own text. If its language differs from the page, put the trail in a nested KvirnProvider and spread useLocale().localeProps on your own element around it (3.1.2 Language of Parts, AA).
Your own separator
The theme draws a chevron between the levels, and variant="slash" draws a slash. For anything else, such as an icon or a component of yours, pass it as separator on the root. It goes in every item, and the theme hides the first. The chevronForward icon from @kvirn-ui/icons flips itself in right-to-left text; an icon of your own needs mirrorInRtl.
import { Breadcrumb, Icon } from '@kvirn-ui/react'
import { useBreadcrumbTexts } from './texts.ts'
export function CustomSeparator() {
const { texts } = useBreadcrumbTexts()
return (
<Breadcrumb.Root label={texts.separatorLabel} separator={<Icon name="chevron-forward" />}>
<Breadcrumb.List>
<Breadcrumb.Item>
<Breadcrumb.Link href="#start">{texts.start}</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Item>
<Breadcrumb.Link href="#services">{texts.services}</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Item>
<Breadcrumb.Current>{texts.homeCareFees}</Breadcrumb.Current>
</Breadcrumb.Item>
</Breadcrumb.List>
</Breadcrumb.Root>
)
}Props in this example:
separatoron Breadcrumb.Root
Warning: Don't forget
Keep a separator to decoration: nothing a keyboard can reach, such as a link or a button. Screen readers skip it, so anything focusable in it would be reachable but have no name (4.1.2 Name, Role, Value, A).
A trail in Swedish
The trail takes its name from the provider’s language: a Swedish provider gives it a Swedish name, and a Finnish provider a Finnish one. Give the provider the locale and its messages, and write no label. Here a nested provider keeps the rest of this page in English. The names of the levels are your own text, so this example writes them in Swedish too. A site that is in Swedish throughout sets the locale once, on the provider at the top.
import { sv } from '@kvirn-ui/i18n/sv'
import { Breadcrumb, KvirnProvider, useLocale } from '@kvirn-ui/react'
import { useBreadcrumbTexts } from './texts.ts'
function SwedishTrail() {
const { localeProps } = useLocale()
const { texts } = useBreadcrumbTexts()
return (
<div {...localeProps}>
<Breadcrumb.Root>
<Breadcrumb.List>
<Breadcrumb.Item>
<Breadcrumb.Link href="#start">{texts.start}</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Item>
<Breadcrumb.Link href="#children">{texts.children}</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Item>
<Breadcrumb.Current>{texts.preschool}</Breadcrumb.Current>
</Breadcrumb.Item>
</Breadcrumb.List>
</Breadcrumb.Root>
</div>
)
}
// On a site that is in Swedish throughout, the one provider at the top has this locale and
// messages, and no nested provider is needed.
export function OtherLanguageBreadcrumb() {
return (
<KvirnProvider locale="sv-FI" messages={sv}>
<SwedishTrail />
</KvirnProvider>
)
}Information: Did you know?
The name exists in all five languages. Have a native speaker check the text in each language you ship before you publish.
A trail in your own markup
When you write the elements yourself, call useBreadcrumb and spread each set of props on the element it names: the <nav>, the <ol>, each <li> and the last item’s <span>. You get the classes, the name, the list role and aria-current. Here the slash variant gives a path-like trail for a case system that staff use.
import { Link, useBreadcrumb } from '@kvirn-ui/react'
import { useBreadcrumbTexts } from './texts.ts'
export function OwnMarkup() {
const { texts } = useBreadcrumbTexts()
const breadcrumb = useBreadcrumb({ variant: 'slash', label: texts.ownMarkupLabel })
return (
<nav {...breadcrumb.rootProps}>
<ol {...breadcrumb.listProps}>
<li {...breadcrumb.itemProps}>
<Link.Root href="#cases" className="kv-breadcrumb-link">
{texts.cases}
</Link.Root>
</li>
<li {...breadcrumb.itemProps}>
<Link.Root href="#permits" className="kv-breadcrumb-link">
{texts.permits}
</Link.Root>
</li>
<li {...breadcrumb.itemProps}>
<span {...breadcrumb.currentProps}>{texts.permitCase}</span>
</li>
</ol>
</nav>
)
}Props in this example:
Warning: Don't forget
Give each link the class kv-breadcrumb-link: the hook doesn’t. The default theme uses it to keep the link tall enough to press (2.5.8 Target Size (Minimum), AA).
Accessibility#
What it does for you#
- APG pattern: Breadcrumb: a
<nav>named by a label around an ordered list of links. - Deviations: none. The current page is the last item as text (
<span aria-current="page">), not a link to the page you are on. The APG makesaria-currentoptional when the current item is not a link; here it is set, so the current item is still exposed, and a link to the same page offers nothing to follow. The current page is simply not a Tab stop. - Native elements used:
<nav>(thenavigationlandmark),<ol>and<li>. The links are Links: native<a href>, rendered by the registered router link.
A breadcrumb tells a resident where they are and gives a way up. It adds no tabindex, no key handling, no state and no announcement: the links are the focusable parts and own the keys.
| Part | Element / role | ARIA | Notes |
|---|---|---|---|
Breadcrumb.Root | <nav> → navigation | aria-label from label or breadcrumb.label | class="kv-breadcrumb". Named, so a screen reader user finds it in the landmarks list. Place it before <main>, not in it |
Breadcrumb.List | <ol> → list | role="list" | Ordered: the sequence is the meaning. The explicit role="list" keeps the list announced in Safari/VoiceOver, which drops it from a list with list-style: none (1.3.1 Info and Relationships, A) |
Breadcrumb.Item | <li> → listitem | none | Holds a Breadcrumb.Link, or the last item's Breadcrumb.Current |
Breadcrumb.Link | <a href> → link | none | A thin wrapper over Link.Root: the registered router link, the same props and ref |
Breadcrumb.Current | <span> | aria-current="page" | The page you are on: text, the last item, never a link. One aria-current per trail |
| Separators | CSS generated content, ::before | none | Empty alternative text, so never read. The chevron mirrors in RTL. Not in the markup. variant="slash" adds kv-breadcrumb--slash to the root and swaps the character |
| Custom separator | <span class="kv-breadcrumb-separator"> | aria-hidden="true" | From Breadcrumb.Root's separator, in every item; the theme hides the first one. Replaces the generated one. Decoration only: never interactive or focusable, and never in the accessibility tree |
| Parts | as on Breadcrumb.Link only | none | Link.Root's as: as="a" bypasses the router. Root, List, Item and Current have no as: the landmark and the list are fixed by the contract |
It announces nothing.
What you need to do#
- List every level from the home page to the current page's parent, each a link, then the current page as
Breadcrumb.Current. It never collapses into "…": a hidden level is a hidden way out (2.4.8 Location, AAA, beyond the AA bar). It wraps onto more lines instead. - Do not link the current page, and mark no other item
aria-current. - Link text is the page's title: "Start", not "Home link" or "Click here" (2.4.4 Link Purpose (In Context), A).
- Put it in the same place on every page that has one. The trail is repeated on many pages, and people look for it in the same spot.
- Breadcrumb supports, but doesn't satisfy, 2.4.5 Multiple Ways (AA). The site needs search or a site map as well.
- Name two navigations differently when a page has another
<nav>: this one is namedYou are here, so the other is not. - Language. A custom
labelis your own string: put it in a nestedKvirnProviderwithuseLocale().localePropson your own element if it differs from the page (3.1.2 Language of Parts, AA). - A custom
separatoris decorative. It isaria-hidden; if it needs a name, it is not a separator. Never put anything interactive or focusable in it (aria-hiddenover focusable content is a mistake). The defaultchevron-forwardmirrors itself in RTL; a registered or own icon needsmirrorInRtl. It is never the only cue between levels: the items are separate list items (1.4.1 Use of Color, A). - Keep the look in a custom theme. See Visual / modes.
Warning: Don't forget
A breadcrumb helps people move up, but it is not a way to find pages. Your site also needs search or a site map (2.4.5 Multiple Ways, AA).
Visual and modes#
- Focus indicator: a link shows the focus ring (
:focus-visible), throughLink. - Target size: at least 24 by 24 pixels (2.5.8 Target Size (Minimum), AA).
- Separators: the first item's separator is hidden (it is rendered in every item). A separator is never the only cue between levels, because the items are separate list items (1.4.1 Use of Color, A).
- Reflow: the trail wraps at 320 pixels wide (1.4.10 Reflow, AA): the reflow sweep runs every story at 320 CSS px and fails on horizontal overflow.
- Forced colours and reduced motion: the trail follows the system colours and nothing animates. The forced-colours and reduced-motion sweeps check it.
A custom theme must keep these.
Focus management#
- Initial focus: not moved. Focus is never moved by the component.
- Trap: no. Restore to: not applicable.
- A link shows the focus ring (
:focus-visible), throughLink.
WCAG success criteria#
- 1.1.1 Non-text Content (A): the separator is decoration, never read.
- 1.3.1 Info and Relationships (A): a landmark, an ordered list, the current page.
- 1.4.1 Use of Color (A): the current page is shown by text weight that differs from the links plus
aria-current, not by colour. - 1.4.10 Reflow (AA): wraps at 320 pixels wide.
- 1.4.11 Non-text Contrast (AA): a custom separator is decoration, so it has no contrast need.
- 2.4.4 Link Purpose (In Context) (A): the link text is the page's title.
- 2.5.8 Target Size (Minimum) (AA).
- 3.1.2 Language of Parts (AA): a custom
labelin another language is marked by the consumer. - 4.1.2 Name, Role, Value (A).
- 2.4.8 Location (AAA, beyond the AA bar): the trail shows where the page sits.
Designed and tested to meet WCAG 2.2 AA.
Keyboard#
- Focus
- native
- Selection follows focus
- n/a
- Arrows wrap
- n/a
- Shortcuts
- none
Native tab order. No key is intercepted, and the arrow keys do nothing.
| Key | Where | What happens |
|---|---|---|
| Tab | before / on the trail | Moves to the next link, in order. The current page is not a stop, so the next Tab leaves the trail Test: breadcrumb.test.tsx › Breadcrumb keyboard › Tab moves through the links in order and the current page is not a stop |
| Shift+Tab | on a link | Moves to the previous link Test: breadcrumb.test.tsx › Breadcrumb keyboard › Shift+Tab moves to the previous link |
| Enter | on a link | Follows it: a router link navigates without a page load, and focus stays on the link Test: breadcrumb.test.tsx › Breadcrumb keyboard › Enter follows a link through the registered router link, without a page load |
| Space | on a link | Not handled (a link: the page scrolls natively) Test: breadcrumb.test.tsx › Breadcrumb keyboard › Space is not handled |
API reference#
import { Breadcrumb, useBreadcrumb } from '@kvirn-ui/react'Breadcrumb.Root
Renders <nav>, the navigation landmark, named by the message breadcrumb.label or your label. It takes every attribute of a <nav> and passes ref to it. The default theme is described on Theming.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'chevron' | 'slash' | 'chevron' | The separator the theme draws. slash adds kv-breadcrumb--slash; chevron adds no class. It is decoration with an empty text alternative. |
separator | ReactNode | – | Your own separator, rendered in every item (the theme hides the first one, and a custom theme must too): an Icon or a component. It is aria-hidden, so it must be decorative, never interactive. The chevronForward icon from @kvirn-ui/icons mirrors itself in RTL; an icon of your own needs mirrorInRtl. |
label | string | the message breadcrumb.label | The accessible name, from your translations. Set as aria-label. An empty or whitespace-only label counts as none and the message is used. |
messages | Partial<KvirnMessages['breadcrumb']> | – | Overrides breadcrumb.label for this trail. |
| Class or attribute | Values | Meaning |
|---|---|---|
kv-breadcrumb | always | The part class. The default theme styles it. |
kv-breadcrumb--slash | variant="slash" | Swaps the generated chevron for a slash. The default adds no class. |
aria-label | the name | Always set, from label or the message breadcrumb.label. |
Breadcrumb.List
Renders <ol> with the role list. It is ordered, because the sequence is the meaning.
| Class or attribute | Values | Meaning |
|---|---|---|
kv-breadcrumb-list | always | The part class. |
Breadcrumb.Item
Renders <li> with the role listitem. It holds a Breadcrumb.Link, or the last item’s Breadcrumb.Current.
| Class or attribute | Values | Meaning |
|---|---|---|
kv-breadcrumb-item | always | The part class. The default theme draws the separator before every item but the first. |
kv-breadcrumb-separator | when the root has a separator | A span inside the item with aria-hidden="true", holding your separator. |
Breadcrumb.Link
Renders <a href>: a thin wrapper over Link.Root, so it is rendered by the router link you register on the provider. It takes the same props and ref as Link.Root, so as="a" skips the router link.
| Class or attribute | Values | Meaning |
|---|---|---|
kv-breadcrumb-link | always | The part class, next to kv-link. |
Breadcrumb.Current
Renders <span> with aria-current="page". The page you are on, as text: the last item, never a link.
| Class or attribute | Values | Meaning |
|---|---|---|
kv-breadcrumb-current | always | The part class. |
aria-current | "page" | Always set. Mark no other item in the trail. |
useBreadcrumb
Options
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'chevron' | 'slash' | 'chevron' | The generated separator. slash adds kv-breadcrumb--slash to rootProps. |
label | string | the message breadcrumb.label | The accessible name, set as aria-label. An empty label counts as none. |
messages | Partial<KvirnMessages['breadcrumb']> | – | Per-instance message overrides: { label: "Where you are" }. |
Result
| Prop | Type | Default | Description |
|---|---|---|---|
rootProps | BreadcrumbRootPartProps | – | Spread on the <nav>: the class and aria-label. |
listProps | BreadcrumbListPartProps | – | Spread on the <ol>: the class. |
itemProps | BreadcrumbItemPartProps | – | Spread on every <li>: the class. |
currentProps | BreadcrumbCurrentPartProps | – | Spread on the current page’s <span>: the class and aria-current="page". |
separatorProps | BreadcrumbSeparatorPartProps | – | Spread on a <span> you render inside an item for your own separator: the class and aria-hidden="true". The default theme hides the separator in the first item. |
label | string | – | The resolved name of the landmark. |
Strings
These are the default texts in @kvirn-ui/i18n.
For your whole app, pass messages to KvirnProvider. For one Breadcrumb, pass its messages prop.
breadcrumb.label
The landmark’s accessible name, set as aria-label. It says what the trail is for.
| Language | Default text |
|---|---|
| Svenska | Du är här |
| Suomi | Olet tässä |
| Norsk bokmål | Du er her |
| Norsk nynorsk | Du er her |
| English | You are here |
Testing#
The automated tests prove the keyboard behaviour, the names and states, that axe finds no violations in every story and theme, and, for the components they cover, that the stories hold up in forced colours, reduced motion, text spacing and a 320 pixel width. An Automated row passes on these tests alone. A Core or Release row passes only when an automated agent check and a person on the real assistive technology have both checked it. "agent-verified" means automated tests in the repository (with a virtual screen reader for the screen reader rows), not the real assistive technology.
| AT + browser + OS | Agent check | Human check | Result | Notes |
|---|---|---|---|---|
| Automated (re-runnable tests) | ||||
| axe, WCAG 2.2 A and AA, every story, 4 themes | pass | n/a | pass | breadcrumb.stories.tsx, every story, 4 themes |
| Markup and ARIA (roles, names, ids, states) | pass | n/a | pass | breadcrumb.test.tsx (axe and role, name and state): is a navigation landmark named by the message breadcrumb.label |
| Keyboard contract rows (Vitest browser) | pass | n/a | pass | 4 rows, each names a test in breadcrumb.test.tsx |
| Focus order and management | pass | n/a | pass | breadcrumb.test.tsx asserts focus |
| Display modes (forced colours, 320px reflow, text spacing, reduced motion) | pass | n/a | pass | the four sweep projects (storybook-forced-colors, -reduced-motion, -reflow, -text-spacing), run in CI |
| Core (required for beta) | ||||
| NVDA + Chrome + Windows | pending | pending | pending | |
| VoiceOver + Safari + iOS | pending | pending | pending | |
| Release (before 1.0 and each minor) | ||||
| JAWS + Chrome + Windows | pending | pending | pending | |
| TalkBack + Chrome + Android | pending | pending | pending | |
| VoiceOver + Safari + macOS | pending | pending | pending |
What to check#
With a screen reader and the keyboard, try:
- The landmarks list shows "You are here" (or your label) once.
- Tab along the trail: each level is a link, in order. The current page is not a stop.
- Reading the trail says "list" with the item count, and the current page as current.
- Enter on a level goes there, and focus is not lost.
- The separators are not read.
- At 320px and in right-to-left text the trail wraps and the separators face the right way.