Skip to main content
cngx-src documentation

CngxBreadcrumb

DirectivePrimaryv0.1.0WCAG AA

projects/common/interactive/breadcrumb/breadcrumb.directive.ts

Import#

import { CngxBreadcrumb } from '@cngx/common/interactive'

Description#

Linear breadcrumb navigation. Put cngxBreadcrumb on the <nav>; it names the landmark (aria-label, EN default "Breadcrumb") and, when the trail exceeds [maxVisible], derives which middle crumbs collapse - keeping the first crumb and the last maxVisible - 1. The collapse set is a computed() over the projected items, so terminal-crumb marking and overflow are pure derivation, never synced (Pillar 1). Consumers render the collapsed crumbs in an ellipsis CngxMenu and may truncate long labels with CngxTruncate.

<nav cngxBreadcrumb [maxVisible]="4" #bc="cngxBreadcrumb">
  <ol>
    <li><a cngxBreadcrumbItem href="/">Home</a></li>
    <li cngxBreadcrumbSeparator>/</li>
    <li><a cngxBreadcrumbItem href="/library">Library</a></li>
    <li cngxBreadcrumbSeparator>/</li>
    <li><span cngxBreadcrumbItem>Current page</span></li>
  </ol>
</nav>

https://cngxjs.github.io/cngx/examples/#/common/interactive/breadcrumb/basic-trail

Metadata#

Host#

Providers#

CNGX_BREADCRUMB
useExisting CngxBreadcrumb

Relationships

Index#

Inputs#

label#string
input()

Accessible name of the navigation landmark. EN default.

default 'Breadcrumb'
maxVisible#number | undefined
input()

Maximum crumbs to show before the middle collapses. Unset = never collapse.

Methods#

isCollapsed#boolean
isCollapsed(item: CngxBreadcrumbItem)
isTerminal#boolean
isTerminal(item: CngxBreadcrumbItem)

HostBindings#

BindingExpression
[attr.aria-label]label()