abaabil

Breadcrumb

2nd lightest of the twenty-three, by js weight

A <nav> around an ordered list, because the order is the information. Server-renderable at every tier, and the lightest component in the library.

Example (a11y tier)

Import

import Breadcrumb from 'abaabil/breadcrumb'         // structure only
import Breadcrumb from 'abaabil/breadcrumb/styled'  // + CSS
import Breadcrumb from 'abaabil/breadcrumb/a11y'    // + nav name, aria-current

Three details that are usually wrong

The separator is drawn, not rendered. A slash or chevron typed between the links ends up in the accessibility tree, and a screen reader reads it: “Home slash Docs slash Buttons”. Here it is a CSS pseudo-element, so it is seen and never heard. It is a chevron built from two logical borders, so it turns around in right-to-left text without an override.

The <nav> is named. A page usually has more than one navigation landmark, and a screen reader user listing them hears “navigation, navigation, navigation” unless each one says what it is.

The last item is not a link. A link to the page you are already on is a link that does nothing, so the final entry renders as text even if you give it an href, and carries aria-current="page" either way. Pass linkCurrent if you need it to stay a link.

Props

PropTypeDefaultTierDescription
itemsArray<{ key?, label, href? }>allRoot first. An item with no href renders as text.
classNamestringallMerged with the base class.
labelstring'Breadcrumb'a11yNames the <nav>.
linkCurrentbooleanfalsea11yKeep the last item a link, still marked current.