Where a page sits in its tree, with each step a link and a long trail folded.
Installation
Usage
import { Breadcrumbs } from "./ui/uicontext/components/kit/Breadcrumbs.ts"const Message = UiSchema.TaggedEnum({ OpenedPage: { id: Schema.String } })export const PageTrail = (h: Html.H<typeof Message.Type>) => Breadcrumbs(h, { props: { trail: [ { id: "handbook", label: "Handbook", icon: "📘" }, { id: "onboarding", label: "Onboarding" }, { id: "first-week", label: "Your first week" }, ], }, onEmit: { RequestedOpen: ({ id }) => Message.OpenedPage({ id }) }, })Examples
Short trail with links
Give a step an href and it renders as a link, so people can open it in a new tab.
More steps before folding
A wide page can show more of the trail: here the first step and the last three stay visible.
API reference
Props
| Name | Type | Description |
|---|---|---|
trailrequired | BreadcrumbStep[] | The steps from the top to the current page, which is last |
label | string | The landmark's name: "Breadcrumb" |
max | number | The most steps shown before the middle folds into "…" (4) |
Events
| Event | Payload | Description |
|---|---|---|
RequestedOpen | { id: string } | A step without a link, or a folded one, was chosen |
Accessibility
- A
navlandmark named Breadcrumb holding an ordered list; the page itself isaria-current="page". - Folded steps sit in a menu button that names how many it holds.