Web and native

Breadcrumbs in kanso-ui 0.59.0, for React.

import { Breadcrumbs } from '@kanso-labs/kanso-ui'

A trail of links back up a hierarchy, ending at the page you are on.

The trail is an ordered list. React Aria makes the last item the current one and marks it aria-current="page"; it is drawn as plain text in the full-strength on-surface colour rather than as a faded, disabled link, so the page you are on is the most legible item in the row. Every earlier item is a link in the row's muted colour, underlined on hover, followed by a chevron that points further in and mirrors in right-to-left layouts. The row wraps rather than scrolling or truncating when it runs out of room.

What you provide

  • aria-label or aria-labelledby to name the trail.
  • One Breadcrumbs.Item per level, in order. Give each an href, except the last, which is never a link.
  • For a page that routes on its own, give each item an id and the trail an onAction, which reports the key that was pressed.

Props

PropTypeDefaultDescription
childrenReactNode—The trail, as `Breadcrumbs.Item` entries.

Also takes the props of Omit<BreadcrumbsProps$1<T>, 'children'>.

Parts

  • children: the item's label.
  • href: where it leads. Leave it out on the current item, and on items the trail's onAction handles.
  • id: the key onAction reports.
  • rel and target: passed to the link.

Example

import { Breadcrumbs } from '@kanso-labs/kanso-ui'
<Breadcrumbs aria-label="Label">
  <Breadcrumbs.Item href="#first">First item</Breadcrumbs.Item>
  <Breadcrumbs.Item href="#second">Second item</Breadcrumbs.Item>
  <Breadcrumbs.Item>Third item</Breadcrumbs.Item>
</Breadcrumbs>

The design’s classes

k-crumbs on the ol, k-icon k-crumbs__sep on each separator item, and aria-current="page" on the current page. In kanso-ui and react-native-kanso-ui it is Breadcrumbs.