Skip to main content

Module breadcrumb

Module breadcrumb 

Source
Expand description

Breadcrumb — a navigational trail with automatic overflow into a … menu.

Breadcrumb renders a horizontal row of labelled segments separated by chevron glyphs, representing a hierarchical path (file system, settings hierarchy, wizard steps, etc.). When the trail is too wide to fit its container, middle segments are automatically collapsed into a … popover menu — the root and the current (last) segment always stay visible, matching Windows Explorer, macOS path bar, and web breadcrumb conventions.

§Building a trail

let _bc = Breadcrumb::new()
    .item(BreadcrumbItem::new(lit!("Home"))
        .on_activate_fn(|ctx| ctx.send_intent(Intent::new("app.nav.home"))))
    .item(BreadcrumbItem::new(lit!("Projects"))
        .on_activate_fn(|ctx| ctx.send_intent(Intent::new("app.nav.projects"))))
    .item(BreadcrumbItem::current(lit!("Teksilo")));

§Accessibility

The container uses Role::Navigation; each segment uses Role::Link. The current crumb sets aria-current="page". The decorative separator chevrons are hidden from the AT tree. The … overflow button declares HasPopup::Menu.

§Touch and pen

A crumb navigates on the release. It is as wide as its label, so a short one (“A / B / C”, a drive letter) can land under the 24 dp target floor; it declares a Widget::hit_outset that makes the shortfall up between the pointer and the arena, so the trail’s own geometry never moves. The current crumb and a trail with no navigation action declare none — a widened node that then refuses the press is a hole in whatever is behind it.

Structs§

Breadcrumb
A breadcrumb navigation row with automatic overflow: when the trail is too wide, the middle crumbs collapse into a trailing-of-root … menu while the root and the current (last) crumb stay visible — the standard breadcrumb collapse (Windows Explorer / web breadcrumbs / macOS path bar).
BreadcrumbItem
A single breadcrumb segment definition.

Constants§

BREADCRUMB_CORNER_RADIUS
Corner radius of the interactive segment hover/focus rectangle.
BREADCRUMB_ITEM_HEIGHT
Minimum height of a single breadcrumb segment in logical pixels.
BREADCRUMB_ITEM_PADDING_HORIZONTAL
Horizontal inner padding of each segment pill in logical pixels.
BREADCRUMB_SEPARATOR_GAP
Gap reserved for the chevron separator between adjacent segments.

Functions§

breadcrumb_item_padding_horizontal
BREADCRUMB_ITEM_PADDING_HORIZONTAL scaled by the density’s spacing_factor (1.00 / 1.15 / 1.30).
breadcrumb_separator_gap
BREADCRUMB_SEPARATOR_GAP scaled by the density’s spacing_factor (1.00 / 1.15 / 1.30).