forty-cdk
llms.txt

Primitives

Breadcrumbs

A labelled navigation landmark for a breadcrumb trail: links with aria-current='page' on the current page and decorative separators hidden from assistive technology.

forty-cdk/breadcrumbs WAI-ARIA APG

Walk the trail with Tab: the last crumb is the page you are on, so it carries aria-current="page" and is announced as the current page.

Anatomy

<nav forBreadcrumbs>
  <ol>
    <li><a forBreadcrumbItem href="/">Home</a></li>
    <li forBreadcrumbSeparator>/</li>
    <li><a forBreadcrumbItem href="/data" current>Data</a></li>
  </ol>
</nav>

Examples

Collapsing a long trail

The primitive renders whatever items you give it, so collapsing a deep path is a consumer decision. Here the middle is folded into an expandable ellipsis button that reveals the hidden crumbs. Expanding removes the button, so focus moves to the first crumb it revealed instead of falling back to the page. The trail stays a single accessible navigation landmark either way.

API

ForBreadcrumbs

PropertyTypeDescription
ariaLabel
input
Accessible label for the navigation landmark. Override when a page hosts more than one breadcrumb trail.
Default: 'Breadcrumb'

ForBreadcrumbItem

PropertyTypeDescription
current
input
When true, reflects aria-current="page" on the link.
Default: false

Scoped defaults

provideForBreadcrumbsDefaults configures breadcrumb defaults for an injector subtree, either at the application root or in any component's providers array. Partial overrides inherit unspecified keys from the parent scope (or the library fallbacks at the root).

KeyLibrary fallbackMeaning
label'Breadcrumb'Accessible name of the navigation landmark, for trails that don't set [ariaLabel] themselves.

label is verbalized by screen readers, so translate it here to rename every breadcrumb landmark in the scope. It accepts a string or a function returning one; a function can read a language signal, so the name follows a language the app sets or switches after bootstrap, as Localizing default text shows.

Per-instance inputs always win over the scope defaults.

import { type ApplicationConfig } from '@angular/core';
import { provideForBreadcrumbsDefaults } from 'forty-cdk/defaults';

export const appConfig: ApplicationConfig = {
  providers: [provideForBreadcrumbsDefaults({ label: 'Ruta de navegación' })],
};

Accessibility

Implements the WAI-ARIA Breadcrumb pattern.

  • Navigation landmark. [forBreadcrumbs] applies role="navigation" and labels it aria-label="Breadcrumb" by default, creating a named landmark that screen-reader users can jump to directly. When a page hosts more than one trail, name each with [ariaLabel], or point a native aria-labelledby at a visible heading.
  • Current page. Set current on [forBreadcrumbItem] for the active page; the directive reflects aria-current="page" so assistive technology announces the user's location in the trail.
  • Decorative separators. [forBreadcrumbSeparator] reflects aria-hidden="true" so the visual divider (e.g. /) is skipped by screen readers.

Styling

forty-cdk ships no styles: put your own class on each piece and key your CSS off the aria-current="page" the current item reflects, not off the for* selectors (Styling forty-cdk explains why).

.bc-link[aria-current='page'] {
  font-weight: bold;
  color: inherit;
  text-decoration: none;
}