Breadcrumb (legacy)
Breadcrumb is a legacy migration surface: the Rust crate's path trail — a <nav aria-label="Breadcrumb"> holding BreadcrumbItems, each an anchor (or a plain span) followed by a chevron separator. BreadcrumbSeparator is the same chevron as a standalone element. It keeps existing Rust pages building; new code should prefer the Vue trail, HkBreadcrumb.
The three pieces have no pages of their own — BreadcrumbItem and BreadcrumbSeparator are documented here with the container that arranges them.
- The two are not mirrors of each other, despite the shared name. HkBreadcrumb is a Vue-only component that takes one items array ({ label, to }) and renders an <ol> whose items it generates; this Breadcrumb is a Rust container whose children the host writes, with a link/span choice made per item from href and onclick, and it renders neither a list element nor a separator of its own. The same name in the two languages means two different components.
- Reach for it while migrating a Rust page that already renders this shape; on a new surface use HkBreadcrumb, which owns the list semantics and the size steps.
- A trail of sections in a side rail is Sidebar (legacy); a single "back to the list" link is a Link.
Import
use *; // Breadcrumb, BreadcrumbItem, BreadcrumbSeparator
use *; // BreadcrumbProps, BreadcrumbItemProps, rsx!, VNode
Each is a plain function taking its props struct: Breadcrumb(BreadcrumbProps { … }), BreadcrumbItem(BreadcrumbItemProps { … }), BreadcrumbSeparator(BreadcrumbSeparatorProps { … }). The two props structs with fields — BreadcrumbProps and BreadcrumbItemProps — are in the prelude; BreadcrumbSeparator declares its one parameter inline, so its struct is not. Every field of all three has a default, so inside rsx! every prop may be omitted — including item_key, which then renders as the empty string. Two spellings do not work, and both come from the sliding required-slot rule: the trailing children of Breadcrumb has to be written bare (children: rsx! { … }), and an item's children likewise (children: rsx! { span { "Home" } } — note the trailing comma); Some(…) around either is a type error.
The trail and its items
Breadcrumb builds its class list from the palette (hk-breadcrumb plus flex-row and a 0.5rem gap), appends class, and writes aria-label="Breadcrumb" onto the <nav>. Its children are the items, in order, and nothing else — the component adds no leaf and no trailing separator.
BreadcrumbItem takes three shapes, decided by its two fields: with href it renders <a class="hk-breadcrumb-link">; without href but with onclick it renders a <span class="hk-breadcrumb-link"> that still carries the handler; with neither it renders <span class="hk-breadcrumb-current">. In every shape a span.hk-breadcrumb-separator holding the chevron is appended after the label, so a trail of three items draws three chevrons and the last one trails the current page. item_key defaults to the empty string and the markup does not read it at all.
A press instead of a link, and class
An item with onclick and no href is the host's own router case: the span is not focusable and carries no role, but the handler is wired, and the sheet's .hk-breadcrumb-item:last-child .hk-breadcrumb-link rule makes the last item's text read as the current page and takes its pointer events away — so a click handler belongs on the items before the last one.
class on the container is appended after the palette classes, and class on an item after that item's own; both are the escape hatches for spacing a single trail.
The standalone separator
BreadcrumbSeparator renders span.hk-breadcrumb-separator and takes a single separator string, empty by default. Empty means the 16px chevron SVG; any non-empty value is written as text instead, so separator: "›".to_string() gives a character divider. Note that this is not the separator on BreadcrumbProps — that one is declared on the container, defaults to "/", and no code path reads it, so it never reaches an item or the page.
An item already appends its own chevron, so a separator placed between items doubles the divider: use the standalone element with items whose chevron you have suppressed, or as a divider in a hand-written trail.
API
Rust
Props — Breadcrumb
| Prop | Type | Default | Description |
|---|---|---|---|
| separator | String | "/".to_string() | — |
| class | String | "" | — |
| children | Element | (empty) | — |
Props — BreadcrumbItem
| Prop | Type | Default | Description |
|---|---|---|---|
| item_key | String | "" | — |
| href | Option<String> | None | — |
| children | Element | (empty) | — |
| class | String | "" | — |
| onclick | Option<EventHandler<MouseEvent>> | None | — |
Props — BreadcrumbSeparator
| Prop | Type | Default | Description |
|---|---|---|---|
| separator | String | "" | — |
Accessibility
- The container is a real <nav> named "Breadcrumb", so a screen-reader user gets a navigation landmark they can jump to. Two trails on one page produce two landmarks with the same name; split them or rename one in the host markup.
- There is no list: the items are divs of links and spans, so the number of levels and the "current page" are not announced. aria-current="page" is not written by either component — the current item is marked by the hk-breadcrumb-current class and by the sheet's last-child rule alone.
- The chevron separator is an inline SVG with no aria-hidden and no title, so a screen reader may stop on it and announce nothing. The last item's trailing chevron is the usual offender; the Vue trail HkBreadcrumb omits the separator after the final item.
- An item made clickable through onclick without an href is a <span>: it is not focusable and has no role, so the action is pointer-only. Give the host a real link (an href) whenever the trail must be operable from the keyboard.
- The last item's pointer events are removed by the sheet, which is the right shape for "you are here" and the wrong place for a menu.
Related components
- HkBreadcrumb — the Vue trail with the same name; the preferred spelling for new surfaces, and not a mirror of this component.
- Sidebar (legacy) — the Rust section tree, when the trail is a rail rather than a path.
- Stepper — the numbered sequence bar, when position in a flow matters rather than location in a hierarchy.