Skip to main content

Overview

Breadcrumb provides navigation showing the current page’s location within a hierarchy.

Import

import { MagaryBreadcrumb, BreadcrumbItem } from 'ng-magary';

Basic Usage

<magary-breadcrumb
  [model]="items"
  [home]="homeItem">
</magary-breadcrumb>

With Icons

items: BreadcrumbItem[] = [
  { 
    label: 'Dashboard', 
    icon: 'layout-dashboard',
    routerLink: '/dashboard' 
  },
  { 
    label: 'Settings', 
    icon: 'settings',
    routerLink: '/settings' 
  },
  { 
    label: 'Profile',
    icon: 'user'
  }
];

With Command Handler

items: BreadcrumbItem[] = [
  { 
    label: 'Home',
    command: (event) => {
      console.log('Home clicked', event);
    }
  },
  { 
    label: 'Products',
    command: (event) => {
      this.loadProducts();
    }
  }
];

Disabled Items

items: BreadcrumbItem[] = [
  { label: 'Home', routerLink: '/' },
  { label: 'Archived', disabled: true },
  { label: 'Item' }
];

Input Properties

model
BreadcrumbItem[]
default:"[]"
Array of breadcrumb items
home
BreadcrumbItem
Home item shown at the start
style
Record<string, any>
Inline styles for the component
styleClass
string
CSS class for the component

Output Events

onItemClick
EventEmitter<{originalEvent: Event, item: BreadcrumbItem}>
Emitted when a breadcrumb item is clicked
interface BreadcrumbItem {
  label?: string;
  icon?: string;
  command?: (event?: any) => void;
  url?: string;
  routerLink?: string | any[];
  queryParams?: Record<string, unknown>;
  disabled?: boolean;
  target?: string;
  routerLinkActiveOptions?: IsActiveMatchOptions;
  style?: Record<string, any>;
  styleClass?: string;
  fragment?: string;
  preserveFragment?: boolean;
  skipLocationChange?: boolean;
  replaceUrl?: boolean;
  state?: Record<string, unknown>;
}

Custom Styling

<magary-breadcrumb
  [model]="items"
  [styleClass]="'custom-breadcrumb'">
</magary-breadcrumb>
.custom-breadcrumb {
  background: #f0f0f0;
  padding: 1rem;
  border-radius: 8px;
}

Features

  • Router integration: Works with Angular Router
  • Icons: Support for Lucide icons
  • Custom actions: Command callbacks
  • Disabled state: Non-clickable items
  • Flexible navigation: URLs or router links
  • Query params: Support for query parameters
  • Custom styling: Style and class bindings

Accessibility

  • Semantic HTML structure
  • Proper link roles
  • Keyboard navigation
  • Screen reader support

Build docs developers (and LLMs) love