Angular 面包屑组件 | ng-hub-ui-breadcrumbs

Angular 面包屑组件,支持 Router 集成、自定义模板、RTL 以及灵活的样式 token。

交互式示例

探索实时示例,了解该库在常见 Angular 用例中的表现。

基础面包屑

基础面包屑

直接从路由配置读取的路径,无需额外接线。

Items are generated from the data.breadcrumb configuration of active routes.

代码

动态面包屑

动态面包屑

标签由路由中的占位符与其 resolver 返回的数据组合而成。

The last crumb comes from a route declaring breadcrumb: "Dynamic: {name}", resolved with that route's data. This page has no router tree, so the demo is handed the resulting trail — the route configuration is in the TS tab.

代码

自定义模板

自定义模板

用 hubBreadcrumbItem 模板接管每一项的标记。

The hubBreadcrumbItem directive allows custom rendering of each element.

代码

路径中的图标

路径中的图标

在路由数据中声明的图标,通过自定义项模板渲染。

代码

RTL 布局

RTL 布局

从右到左的支持,分隔符位于路径来向的一侧。

代码

截断与工具提示

截断与工具提示

用省略号截断过长的标签,悬停时显示完整文本。

Each label is capped at --hub-breadcrumb-max-item-width (12rem). Only the items that overflow get a tooltip.

代码

折叠较长的路径

Six crumbs, no collapsing — the default

maxItems = 4 — one crumb each side of the indicator

maxItems = 4 with two crumbs kept on each side

Indicator opened 0 time(s) — that is the collapsedClick output. The trail expands on its own and collapses again on the next navigation.

键盘焦点环

Default ring — press Tab to walk the trail

Re-tinted ring on the same markup

The ring reaches the collapsed indicator too, which is a button and therefore part of the tab order. Note where the overrides live: the focus tokens are declared on :host, so a value set on an ancestor never reaches them — put it on the <hub-breadcrumb> element or inside it. (The accent slot is the one exception, left undeclared on purpose so it does inherit.)

作为信号的路径

INV-2026-0184

in Invoices · 5 levels deep

The heading and the crumbs are two readings of the same signal. Only the trail changes when you move; neither the header nor the component is told anything.