Navigation
Breadcrumbs
Breadcrumbs show where a web page sits below a destination and link back up to each level, such as Payments › Projects › Studio.
In kanso-ui as Breadcrumbs
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-labeloraria-labelledbyto name the trail.- One
Breadcrumbs.Itemper level, in order. Give each anhref, except the last, which is never a link. - For a page that routes on its own, give each item an
idand the trail anonAction, which reports the key that was pressed.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | The trail, as `Breadcrumbs.Item` entries. |
Also takes the props of Omit<BreadcrumbsProps$1<T>, 'children'>.
Parts
Breadcrumbs.Item
children: the item's label.href: where it leads. Leave it out on the current item, and on items the trail'sonActionhandles.id: the keyonActionreports.relandtarget: 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.