Overflow in Angular Breadcrumb component
27 Apr 202416 minutes to read
Overflow Mode
In the Breadcrumb component, maxItems
and overflowMode
properties were used to limit the number of breadcrumb items to be displayed.
In the following example, the maxItems is set as 3 with overflowMode as Default. To prevent breadcrumb item navigation, the enableNavigation
property has been set to false in the Breadcrumb component.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { BreadcrumbModule } from '@syncfusion/ej2-angular-navigations'
import { Component } from '@angular/core';
import { enableRipple } from '@syncfusion/ej2-base';
enableRipple(true);
@Component({
imports: [ BreadcrumbModule],
standalone: true,
selector: 'app-root',
template: `<div class="e-section-control">
<!-- To Render Breadcrumb. -->
<ejs-breadcrumb [enableNavigation]="false" [maxItems]=3 >
<e-breadcrumb-items>
<e-breadcrumb-item text="Home" url="../"></e-breadcrumb-item>
<e-breadcrumb-item text="Getting" url="./breadcrumb/getting-started"></e-breadcrumb-item>
<e-breadcrumb-item text="Data-Binding" url="./breadcrumb/data-binding"></e-breadcrumb-item>
<e-breadcrumb-item text="Icons" url="./breadcrumb/icons"></e-breadcrumb-item>
<e-breadcrumb-item text="Navigations" url="./breadcrumb/navigations"></e-breadcrumb-item>
<e-breadcrumb-item text="Templates" url="./breadcrumb/templates"></e-breadcrumb-item>
<e-breadcrumb-item text="Overflow" url="./breadcrumb/overflow"></e-breadcrumb-item>
</e-breadcrumb-items>
<ng-template #separatorTemplate>
<span class='e-bicons e-arrow'></span>
</ng-template>
</ejs-breadcrumb>
</div>`
})
export class AppComponent {}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
The following overflow modes are available in the Breadcrumb component.
- Collapsed
- Menu
- Wrap
- Scroll
- Hidden
- None
Collapsed
Collapsed mode shows the first and last Breadcrumb items and hides the remaining items with a collapsed icon. When the collapsed icon is clicked, all items become visible and navigable.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { BreadcrumbModule } from '@syncfusion/ej2-angular-navigations'
import { Component } from '@angular/core';
import { enableRipple } from '@syncfusion/ej2-base';
enableRipple(true);
@Component({
imports: [ BreadcrumbModule],
standalone: true,
selector: 'app-root',
template: `<div class="e-section-control">
<!-- To Render Breadcrumb. -->
<ejs-breadcrumb [enableNavigation]="false" [maxItems]=3 overflowMode="Collapsed" >
<e-breadcrumb-items>
<e-breadcrumb-item text="Home" url="../"></e-breadcrumb-item>
<e-breadcrumb-item text="Getting" url="./breadcrumb/getting-started"></e-breadcrumb-item>
<e-breadcrumb-item text="Data-Binding" url="./breadcrumb/data-binding"></e-breadcrumb-item>
<e-breadcrumb-item text="Icons" url="./breadcrumb/icons"></e-breadcrumb-item>
<e-breadcrumb-item text="Navigations" url="./breadcrumb/navigations"></e-breadcrumb-item>
<e-breadcrumb-item text="Templates" url="./breadcrumb/templates"></e-breadcrumb-item>
<e-breadcrumb-item text="Overflow" url="./breadcrumb/overflow"></e-breadcrumb-item>
</e-breadcrumb-items>
<ng-template #separatorTemplate>
<span class='e-bicons e-arrow'></span>
</ng-template>
</ejs-breadcrumb>
</div>`
})
export class AppComponent {}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
Menu
Menu mode shows the number of Breadcrumb items that can be accommodated within the container space and creates a submenu with the remaining items.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { BreadcrumbModule } from '@syncfusion/ej2-angular-navigations'
import { Component } from '@angular/core';
import { enableRipple } from '@syncfusion/ej2-base';
enableRipple(true);
@Component({
imports: [ BreadcrumbModule],
standalone: true,
selector: 'app-root',
template: `<div class="e-section-control">
<!-- To Render Breadcrumb. -->
<ejs-breadcrumb [enableNavigation]="false" [maxItems]=3 overflowMode="Menu" >
<e-breadcrumb-items>
<e-breadcrumb-item text="Home" url="../"></e-breadcrumb-item>
<e-breadcrumb-item text="Getting" url="./breadcrumb/getting-started"></e-breadcrumb-item>
<e-breadcrumb-item text="Data-Binding" url="./breadcrumb/data-binding"></e-breadcrumb-item>
<e-breadcrumb-item text="Icons" url="./breadcrumb/icons"></e-breadcrumb-item>
<e-breadcrumb-item text="Navigations" url="./breadcrumb/navigations"></e-breadcrumb-item>
<e-breadcrumb-item text="Templates" url="./breadcrumb/templates"></e-breadcrumb-item>
<e-breadcrumb-item text="Overflow" url="./breadcrumb/overflow"></e-breadcrumb-item>
</e-breadcrumb-items>
<ng-template #separatorTemplate>
<span class='e-bicons e-arrow'></span>
</ng-template>
</ejs-breadcrumb>
</div>`
})
export class AppComponent {}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
Wrap
Wrap mode wraps the items to multiple lines when the Breadcrumb’s width exceeds the container space.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { BreadcrumbModule } from '@syncfusion/ej2-angular-navigations'
import { Component } from '@angular/core';
import { enableRipple } from '@syncfusion/ej2-base';
enableRipple(true);
@Component({
imports: [ BreadcrumbModule],
standalone: true,
selector: 'app-root',
template: `<div class="e-section-control">
<!-- To Render Breadcrumb. -->
<ejs-breadcrumb [enableNavigation]="false" [maxItems]=3 overflowMode="Wrap" >
<e-breadcrumb-items>
<e-breadcrumb-item text="Home" url="../"></e-breadcrumb-item>
<e-breadcrumb-item text="Getting" url="./breadcrumb/getting-started"></e-breadcrumb-item>
<e-breadcrumb-item text="Data-Binding" url="./breadcrumb/data-binding"></e-breadcrumb-item>
<e-breadcrumb-item text="Icons" url="./breadcrumb/icons"></e-breadcrumb-item>
<e-breadcrumb-item text="Navigations" url="./breadcrumb/navigations"></e-breadcrumb-item>
<e-breadcrumb-item text="Templates" url="./breadcrumb/templates"></e-breadcrumb-item>
<e-breadcrumb-item text="Overflow" url="./breadcrumb/overflow"></e-breadcrumb-item>
</e-breadcrumb-items>
<ng-template #separatorTemplate>
<span class='e-bicons e-arrow'></span>
</ng-template>
</ejs-breadcrumb>
</div>`
})
export class AppComponent {}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
Scroll
Scroll mode shows an HTML scroll bar when the Breadcrumb’s width exceeds the container space.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { BreadcrumbModule } from '@syncfusion/ej2-angular-navigations'
import { Component } from '@angular/core';
import { enableRipple } from '@syncfusion/ej2-base';
enableRipple(true);
@Component({
imports: [ BreadcrumbModule],
standalone: true,
selector: 'app-root',
template: `<div class="e-section-control">
<!-- To Render Breadcrumb. -->
<ejs-breadcrumb [enableNavigation]="false" [maxItems]=3 overflowMode="Scroll" >
<e-breadcrumb-items>
<e-breadcrumb-item text="Home" url="../"></e-breadcrumb-item>
<e-breadcrumb-item text="Getting" url="./breadcrumb/getting-started"></e-breadcrumb-item>
<e-breadcrumb-item text="Data-Binding" url="./breadcrumb/data-binding"></e-breadcrumb-item>
<e-breadcrumb-item text="Icons" url="./breadcrumb/icons"></e-breadcrumb-item>
<e-breadcrumb-item text="Navigations" url="./breadcrumb/navigations"></e-breadcrumb-item>
<e-breadcrumb-item text="Templates" url="./breadcrumb/templates"></e-breadcrumb-item>
<e-breadcrumb-item text="Overflow" url="./breadcrumb/overflow"></e-breadcrumb-item>
</e-breadcrumb-items>
<ng-template #separatorTemplate>
<span class='e-bicons e-arrow'></span>
</ng-template>
</ejs-breadcrumb>
</div>`
})
export class AppComponent {}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
Hidden
Hidden mode shows the maximum number of items possible in the container space and hides the remaining items. Clicking on a previous item will make the hidden item visible.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { BreadcrumbModule } from '@syncfusion/ej2-angular-navigations'
import { Component } from '@angular/core';
import { enableRipple } from '@syncfusion/ej2-base';
enableRipple(true);
@Component({
imports: [ BreadcrumbModule],
standalone: true,
selector: 'app-root',
template: `<div class="e-section-control">
<!-- To Render Breadcrumb. -->
<ejs-breadcrumb [enableNavigation]="false" [maxItems]=3 overflowMode="Hidden" >
<e-breadcrumb-items>
<e-breadcrumb-item text="Home" url="../"></e-breadcrumb-item>
<e-breadcrumb-item text="Getting" url="./breadcrumb/getting-started"></e-breadcrumb-item>
<e-breadcrumb-item text="Data-Binding" url="./breadcrumb/data-binding"></e-breadcrumb-item>
<e-breadcrumb-item text="Icons" url="./breadcrumb/icons"></e-breadcrumb-item>
<e-breadcrumb-item text="Navigations" url="./breadcrumb/navigations"></e-breadcrumb-item>
<e-breadcrumb-item text="Templates" url="./breadcrumb/templates"></e-breadcrumb-item>
<e-breadcrumb-item text="Overflow" url="./breadcrumb/overflow"></e-breadcrumb-item>
</e-breadcrumb-items>
<ng-template #separatorTemplate>
<span class='e-bicons e-arrow'></span>
</ng-template>
</ejs-breadcrumb>
</div>`
})
export class AppComponent {}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
None
None mode shows all the items on a single line.