Skip to content

Breadcrumb

import { Breadcrumb } from '@yarcl/react';
<Breadcrumb>
<Breadcrumb.Item href="/">Home</Breadcrumb.Item>
<Breadcrumb.Item href="/projects">Projects</Breadcrumb.Item>
<Breadcrumb.Item href="/projects/apollo">Apollo</Breadcrumb.Item>
<Breadcrumb.Item>Settings</Breadcrumb.Item>
</Breadcrumb>

The last item is the current page. Give it an href to keep it a link, or leave it out to render plain text.

For client-side navigation, see the router link recipe.

Set maxItems to collapse the middle of a longer trail into an ellipsis button. Activating it shows the full trail and moves focus to the first item that was hidden. itemsBeforeCollapse and itemsAfterCollapse choose how many items stay visible on each side.

<Breadcrumb maxItems={3} separator="/">
<Breadcrumb.Item href="/">Home</Breadcrumb.Item>
<Breadcrumb.Item href="/docs">Documentation</Breadcrumb.Item>
<Breadcrumb.Item href="/docs/components">Components</Breadcrumb.Item>
<Breadcrumb.Item href="/docs/components/navigation">Navigation</Breadcrumb.Item>
<Breadcrumb.Item>Breadcrumb</Breadcrumb.Item>
</Breadcrumb>

The text style comes from typography.styles and the link color from colors, styled like Link. The current page uses the neutral text color and separators use the muted neutral. Set both per component in the config:

components: {
Breadcrumb: { textStyle: 'caption', color: 'neutral' },
},
  • Renders a <nav> landmark labelled “Breadcrumb” (override with aria-label) around an ordered list.
  • The last item has aria-current="page".
  • Separators are hidden from screen readers.
  • Give each breadcrumb on a page its own aria-label.
Key Action
Tab moves between the links and the ellipsis button
Enter follows a link, or expands the collapsed trail
Space expands the collapsed trail
PropTypeDefaultDescription
childrenReactNodeBreadcrumb.Items, from the root to the current page.
colorColorconfigconfig.defaults.colorLink color, from the colors config.
expandLabelstringconfig.labels.expandBreadcrumbAccessible label of the ellipsis button.
itemsAfterCollapsenumber2Items shown after the ellipsis when collapsed.
itemsBeforeCollapsenumber1Items shown before the ellipsis when collapsed.
maxItemsnumberCollapses the middle of the trail into an expandable ellipsis when there are more items than this. Without it, the trail never collapses.
separatorReactNodea chevron iconContent between items. Hidden from screen readers.
textStyleTextStyleconfigconfig.defaults.textStyleText style, from the typography.styles config.
underline'none' | 'always' | 'hover''hover'When to underline the links.
PropTypeDefaultDescription
childrenReactNodeThe item's label.
hrefstringWhere the item links to. Without it, the item renders as plain text.