TwitterGithub

Breadcrumb

Displays the path to the current resource using a hierarchy of links.

Installation

npx nx g @spartan-ng/cli:ui breadcrumb

Usage

import {
    HlmBreadcrumbDirective,
    HlmBreadcrumbEllipsisComponent,
    HlmBreadcrumbItemDirective,
    HlmBreadcrumbLinkDirective,
    HlmBreadcrumbListDirective,
    HlmBreadcrumbPageDirective,
    HlmBreadcrumbSeparatorComponent,
} from '@spartan-ng/ui-breadcrumb-helm';
<nav hlmBreadcrumb>
    <ol hlmBreadcrumbList>
        <li hlmBreadcrumbItem>
            <a hlmBreadcrumbLink href="/home">Home</a>
        </li>
        <li hlmBreadcrumbSeparator></li>
        <li hlmBreadcrumbItem>
            <hlm-breadcrumb-ellipsis />
        </li>
        <li hlmBreadcrumbSeparator></li>
        <li hlmBreadcrumbItem>
            <a hlmBreadcrumbLink hlmL href="/components">Components</a>
        </li>
        <li hlmBreadcrumbSeparator></li>
        <li hlmBreadcrumbItem>
            <span hlmBreadcrumbPage>Breadcrumb</span>
        </li>
    </ol>
</nav>

Examples

Custom separator

Use a custom component as children for HlmBreadcrumbSeparator to create a custom separator.

import { lucideSlash } from '@ng-icons/lucide';
import { HlmIconComponent, provideIcons } from '@spartan-ng/ui-icon-helm';

...

<nav hlmBreadcrumb>
    <ol hlmBreadcrumbList>
        <li hlmBreadcrumbItem>
            <a hlmBreadcrumbLink link="/home">Home</a>
        </li>
        <li hlmBreadcrumbSeparator>
            <hlm-icon name="lucideSlash" class="h-4 w-4" />
        </li>
        <li hlmBreadcrumbItem>
            <a hlmBreadcrumbLink hlmL link="/components">Components</a>
        </li>
        <li hlmBreadcrumbSeparator>
                <hlm-icon name="lucideSlash" class="h-4 w-4" />
        </li>
        <li hlmBreadcrumbItem>
            <span hlmBreadcrumbPage>Breadcrumb</span>
        </li>
    </ol>
</nav>

Dropdown

You can compose HlmBreadcrumbItem for HlmDropdownMenu to create a custom separator.

import { lmBreadcrumbEllipsisComponent } from '@spartan-ng/ui-breadcrumb-helm';

...

<nav hlmBreadcrumb>
    <ol hlmBreadcrumbList>
        {/*  ...  */}
        <li hlmBreadcrumbItem>
            <hlm-breadcrumb-ellipsis />
        </li>
        {/*  ...  */}
    </ol>
</nav>

Collapsed

We provide a BreadcrumbEllipsis component to show a collapsed state when the breadcrumb is too long.

import { lmBreadcrumbEllipsisComponent } from '@spartan-ng/ui-breadcrumb-helm';

...

<nav hlmBreadcrumb>
    <ol hlmBreadcrumbList>
        {/*  ...  */}
        <li hlmBreadcrumbItem>
            <hlm-breadcrumb-ellipsis />
        </li>
        {/*  ...  */}
    </ol>
</nav>
Button Badge