Breadcrumbs
Where this page sits in the hierarchy.
Overview
A page several levels deep that needs a way back up: org, project, build, snapshot.
Trail
Do
import { Breadcrumbs } from "@hackcove/ui";
<Breadcrumbs
crumbs={[
{ label: "Projects", href: "#projects" },
{ label: "Launch film", href: "#launch-film" },
"Shots",
]}
/>{ label, href } and the last is plain text: the trail that leads back up, ending at the current page.Don't
import { Breadcrumbs } from "@hackcove/ui";
<Breadcrumbs crumbs={["Projects", "Launch film", "Shots"]} />
Hierarchy
Do
import { Breadcrumbs } from "@hackcove/ui";
<Breadcrumbs
crumbs={[{ label: "Acme", href: "#acme" }, { label: "Quotes", href: "#quotes" }, "Quote 12"]}
/>Don't
import { Breadcrumbs } from "@hackcove/ui";
<Breadcrumbs
crumbs={[
{ label: "Quotes", href: "#quotes" },
{ label: "Invoices", href: "#invoices" },
"Receipts",
]}
/>NavTabs.Usage
- Give the trail in order, parents first. A parent that links is
{ label, href }(or{ label, render }for the app's router link); the last crumb is the current page, plain text. - Breadcrumbs show a hierarchy. Peer sections are
NavTabs. - Each crumb truncates, so a long name does not widen the row.
- Put the trail in the
breadcrumbsslot of aPageHeader.
Accessibility
<nav aria-label="Breadcrumb">around an ordered list.- The last item has
aria-current="page"and is never a link. - The
/separators arearia-hidden.
API
Breadcrumbs
org / project / build / snapshot: each crumb truncates, and the last is the current page. A crumb is a node, or a Crumb object when it links.
crumbs required- Type
(ReactNode | Crumb)[]
Functions
crumbLinkClassThe classes of a crumb that links, for a router link drawn outsiderender.