BreadcrumbBreadcrumb provides contextual information about page hierarchy.
Documentation
Import
import {BreadcrumbModule} from 'primeng/breadcrumb';
import {MenuItem} from 'primeng/api';
MenuModel API
Breadcrumb uses the common menumodel api to define its items, visit MenuModel API for details.
Getting Started
Breadcrumb requires a collection of menuitems connected to its model property.
export class BreadcrumbDemo implements OnInit {
private items: MenuItem[];
ngOnInit() {
this.items = [
{label:'Categories'},
{label:'Sports'},
{label:'Football'},
{label:'Countries'},
{label:'Spain'},
{label:'F.C. Barcelona'},
{label:'Squad'},
{label:'Lionel Messi', url: 'https://en.wikipedia.org/wiki/Lionel_Messi'}
];
}
}
<p-breadcrumb [model]="items"></p-breadcrumb>
Properties
Name | Type | Default | Description |
---|---|---|---|
model | array | null | An array of menuitems. |
home | MenuItem | null | MenuItem configuration for the home icon. |
style | string | null | Inline style of the component. |
styleClass | string | null | Style class of the component. |
Styling
Following is the list of structural style classes, for theming classes visit theming page.
Name | Element |
---|---|
ui-breadcrumb | Container element. |
ui-menuitem | Menuitem element. |
ui-menuitem-text | Label of a menuitem. |
ui-breadcrumb-chevron | Chevron element. |
Dependencies
None.
Source
export class BreadcrumbDemo implements OnInit {
items: MenuItem[];
home: MenuItem;
ngOnInit() {
this.items = [
{label:'Categories'},
{label:'Sports'},
{label:'Football'},
{label:'Countries'},
{label:'Spain'},
{label:'F.C. Barcelona'},
{label:'Squad'},
{label:'Lionel Messi', url: 'https://en.wikipedia.org/wiki/Lionel_Messi', icon: 'pi pi-external-link'}
];
this.home = {icon: 'pi pi-home'};
}
}
<p-breadcrumb [model]="items" [home]="home"></p-breadcrumb>