Navigation

Breadcrumb

@xui/breadcrumb

Stands in for crumbs that were dropped from the middle of a trail.

Install

pnpm add @xui/breadcrumb

Add the barrel to a standalone component's imports:

import { XuiBreadcrumbImports } from '@xui/breadcrumb';@Component({  imports: [XuiBreadcrumbImports],  // …})

Examples

Collapsing

Loading preview…

Collapse the middle

Loading preview…

Collapse the middle keeping two ends

Loading preview…

Collapse from end

Loading preview…

Custom current crumb

Source only — this one needs a component of its own to run, so there is nothing to render here.

<xui-breadcrumbs [items]="items">  <ng-template xuiBreadcrumbsCurrent let-item>    <span class="text-primary-emphasis inline-flex items-center gap-1.5 font-semibold">      <ng-icon xui size="sm" name="matFolderRound" />      {{ item.text }}    </span>  </ng-template></xui-breadcrumbs>

Composed

Loading preview…

API

XuiBreadcrumbEllipsis

componentxui-breadcrumb-ellipsis

Stands in for crumbs that were dropped from the middle of a trail.

Inputs

NameTypeDefaultclassClassValueExtra classes, merged into the component's own rather than replacing them.''

XuiBreadcrumbItem

directive[xuiBreadcrumbItem]

One crumb of the trail: the <li> holding a link (or the current page) and its separator.

Inputs

NameTypeDefaultclassClassValueExtra classes, merged into the directive's own rather than replacing them.''activebooleanEmphasise this crumb's contents. Appearance only — mark the current page with xuiBreadcrumbPage, which carries the aria-current a screen reader needs.false
directive[xuiBreadcrumbLink]

A navigable crumb.

Inputs

NameTypeDefaultclassClassValueThe user-defined classes. Merged last so they win over the base classes.''disabledbooleanRenders the crumb as unreachable without dropping it from the trail.false

XuiBreadcrumbList

directive[xuiBreadcrumbList]

The ordered list of crumbs — the layout of the trail.

Inputs

NameTypeDefaultclassClassValueExtra classes, merged into the directive's own rather than replacing them.''

XuiBreadcrumbPage

directive[xuiBreadcrumbPage]

The last crumb — where the user already is.

Inputs

NameTypeDefaultclassClassValueExtra classes, merged into the directive's own rather than replacing them.''

XuiBreadcrumbSeparator

component[xuiBreadcrumbSeparator]

The divider between two crumbs. Defaults to a chevron; project any content to replace it.

Inputs

NameTypeDefaultclassClassValueExtra classes, merged into the component's own rather than replacing them.''

XuiBreadcrumb

directive[xuiBreadcrumb]

The landmark wrapping a breadcrumb trail: a role="navigation" with an accessible name.

Inputs

NameTypeDefaultclassClassValueExtra classes, merged into the directive's own rather than replacing them.''aria-labelstringThe landmark's accessible name. Defaults to breadcrumb; override it when a page has more than one trail, since a screen reader lists landmarks by name.'breadcrumb'

XuiBreadcrumbsItem

directiveng-template[xuiBreadcrumbsItem]

Replaces the default rendering of every crumb.

XuiBreadcrumbsCurrent

directiveng-template[xuiBreadcrumbsCurrent]

Replaces the default rendering of the current crumb only.

XuiBreadcrumbsOverflow

directiveng-template[xuiBreadcrumbsOverflow]

Replaces the ellipsis shown in place of the collapsed crumbs.

XuiBreadcrumbs

componentxui-breadcrumbs

A breadcrumb trail built from an array, collapsing to fit.

Inputs

NameTypeDefaultclassClassValueThe user-defined classes. Merged last so they win over the base classes.''itemsrequiredreadonly T[]The trail, root first. Each entry renders through XuiBreadcrumbData unless a xuiBreadcrumbsItem template overrides it; a wider T is passed through to that template untouched, so extra fields survive the round trip to itemClick.—collapseFromXuiOverflowBoundaryWhich end collapses when the trail is measured. A trail collapses from the start, keeping where you are.'start'minVisibleItemsnumberNever collapse below this many crumbs, however narrow the container gets. Measured collapse only.0maxItemsnumberCollapse the middle once the trail is longer than this many crumbs. 0 — the default — leaves collapsing to the measurement, which is the right behaviour when the trail's width is the only thing at stake. A number takes over completely: the trail no longer measures, so it renders the same on every screen, which is what makes it worth setting.0itemsBeforeCollapsenumberHow many crumbs stay at the root end when the middle collapses.1itemsAfterCollapsenumberHow many crumbs stay at the current end when the middle collapses.1overflowLabelstringAccessible name of the button that opens the collapsed crumbs.'Show the crumbs in between'

Outputs

NameTypeoverflowT[]Emits the collapsed crumbs whenever the set changes.itemClickTEmits when a navigable crumb is activated, from the trail or from the overflow menu.

Source

libs/ui/breadcrumb/xui

xUI 3.0.0 — Apache 2.0 licensed. Built with Angular and Tailwind CSS.