Angular Breadcrumbs Component | ng-hub-ui-breadcrumbs

Angular breadcrumbs component with router integration, custom templates, RTL support and flexible styling tokens.

API reference

Here's the full contract for breadcrumbs: everything you can bind, listen to, project and theme, gathered in one place. Wire up what you need and style what you want — it's standalone and signal-friendly.

Inputs

Dial breadcrumbs in with 8 inputs. Bind them like any Angular @Input.

NameTypeDefaultDescription
hub-breadcrumb · itemsBreadcrumbItem[] | nullnullTrail supplied by the consumer, replacing the one derived from the router. Left null, the component keeps reading HubBreadcrumbsService.
hub-breadcrumb · variantstring—Semantic accent for the breadcrumb links (e.g. primary, success) or any custom token name.
hub-breadcrumb · truncateItemsbooleanfalseWhen true, clips each label to --hub-breadcrumb-max-item-width with an ellipsis and shows a tooltip on overflow. A hubBreadcrumbItem template is covered too: the component wraps the projected content in a span.hub-breadcrumb__custom of its own and clips that, because scoped styles cannot reach elements the consuming component owns.
hub-breadcrumb · maxItemsnumber | undefinedundefinedLength above which the trail collapses behind an indicator. Undefined never collapses, however long the trail grows.
hub-breadcrumb · itemsBeforeCollapsenumber1Crumbs kept at the head of a collapsed trail.
hub-breadcrumb · itemsAfterCollapsenumber1Crumbs kept at the tail of a collapsed trail, the current page included.
hub-breadcrumb · collapsedAriaLabelstring'Show the hidden breadcrumb items'Accessible name of the collapsed indicator, so the one string this component announces can be translated by the host application.
hubBreadcrumbLabel · hubBreadcrumbLabelstring''Explicit tooltip text for a breadcrumb label. When empty, the host text is used as the tooltip, but only while it is truncated.

Outputs

React to what breadcrumbs does — 1 events to hook your logic onto.

NameTypeDescription
hub-breadcrumb · collapsedClickvoidFires when the collapsed indicator is activated. The trail expands on its own; the event is for consumers that want to react as well.

Methods

Drive breadcrumbs from code — 3 methods on its programmatic surface.

NameSignatureReturnsDescription
HubBreadcrumbsService.breadcrumbsbreadcrumbs: Signal<BreadcrumbItem[]>Signal<BreadcrumbItem[]>The trail as a signal, and the surface the component itself reads. It is wrapped once inside the service and subscribed once for the whole application, so a page header, a document title or any other reader derives from it without an async pipe.
HubBreadcrumbsService.breadcrumbs$breadcrumbs$: Observable<BreadcrumbItem[]>Observable<BreadcrumbItem[]>The same trail as an Observable, kept for code already composing with rxjs. Both members report the same navigation; take whichever the calling code already speaks.
provideHubBreadcrumbTooltipprovideHubBreadcrumbTooltip(adapter: HubBreadcrumbTooltipAdapter): EnvironmentProvidersEnvironmentProvidersRegisters a tooltip adapter once for the whole application, so a truncated label shows the richer hub-ui tooltip instead of the native title attribute. Remove the provider and labels fall back to title.

Templates

Make it yours — 2 template slots let you project custom markup.

NameDescriptionExample
hubBreadcrumbItemCustom template for rendering individual breadcrumb items<ng-template hubBreadcrumbItem let-item let-isLast="isLast"> @if (!isLast) { <a [routerLink]="item.url" class="breadcrumb-link">{{ item.label }}</a> } @else { <span class="breadcrumb-current">{{ item.label }}</span> } </ng-template>
hubBreadcrumbLabelDirective that exposes a clipped label’s full text as a tooltip. The component applies it to the labels it renders and to the box it wraps a hubBreadcrumbItem template in, so applying it by hand is only for overriding the tooltip text.<a class="my-crumb" hubBreadcrumbLabel [routerLink]="item.url">{{ item.label }}</a>