Example of Template and Customization in ASP.NET MVC Breadcrumb Control
This sample demonstrates the template functionalities of the Breadcrumb component. The breadcrumb item templates are customized using HTML and CSS.
Custom Breadcrumb
Specific Item Template
Custom Separator
Custom Breadcrumb and Separator
Breadcrumb with Icons
Disabled Breadcrumb
@Html.UiButton(new UiButtonOptions { Id = "reset", Text = "Reset State", Size = UiInputSize.Small })
@Html.UiBreadcrumb(new UiBreadcrumbOptions { Id = "itemTemplate", CssClass = "e-breadcrumb-chips", ItemTemplate = "#chipTemplate", Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Cart" }, new UiBreadcrumbItem { Text = "Billing" }, new UiBreadcrumbItem { Text = "Shipping" }, new UiBreadcrumbItem { Text = "Payment" } } })
@Html.UiBreadcrumb(new UiBreadcrumbOptions { Id = "specific-item-template", CssClass = "e-specific-item-template", ItemTemplate = "#specificItemTemplate", OnBeforeItemRender = "specificItemRender", Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Home", Url = "https://ej2.syncfusion.com/home/aspnetmvc.html" }, new UiBreadcrumbItem { Text = "Components", Url = "https://ej2.syncfusion.com/aspnetmvc/grid/gridoverview" }, new UiBreadcrumbItem { Text = "Navigations", Url = "https://ej2.syncfusion.com/aspnetmvc/menu/defaultfunctionalities" }, new UiBreadcrumbItem { Text = "Breadcrumb", Url = "./defaultfunctionalities" } } })
@Html.UiBreadcrumb(new UiBreadcrumbOptions { Id = "separatorTemplate", SeparatorTemplate = "#arrowSeparator", Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Cart" }, new UiBreadcrumbItem { Text = "Billing" }, new UiBreadcrumbItem { Text = "Shipping" }, new UiBreadcrumbItem { Text = "Payment" } } })
@Html.UiBreadcrumb(new UiBreadcrumbOptions { Id = "bothTemplate", CssClass = "e-custom-breadcrumb", ItemTemplate = "#customTemplate", SeparatorTemplate = "#customSeparator", Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Cart" }, new UiBreadcrumbItem { Text = "Billing" }, new UiBreadcrumbItem { Text = "Shipping" }, new UiBreadcrumbItem { Text = "Payment" } } })
@Html.UiBreadcrumb(new UiBreadcrumbOptions { Id = "icon", Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Program Files", IconCss = "e-bicons e-folder" }, new UiBreadcrumbItem { Text = "Commom Files", IconCss = "e-bicons e-folder" }, new UiBreadcrumbItem { Text = "Services", IconCss = "e-bicons e-folder" }, new UiBreadcrumbItem { Text = "Config.json", IconCss = "e-bicons e-file" } } })
@Html.UiBreadcrumb(new UiBreadcrumbOptions { Id = "disabled", OnBeforeItemRender = "beforeItemRenderHandler", Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Program Files", IconCss = "e-bicons e-folder" }, new UiBreadcrumbItem { Text = "Commom Files", IconCss = "e-bicons e-folder" }, new UiBreadcrumbItem { Text = "Services", IconCss = "e-bicons e-folder" }, new UiBreadcrumbItem { Text = "Config.json", IconCss = "e-bicons e-file" } } })
<style>
.content-wrapper { width: 90%; margin: 0 auto; min-width: 85px; }
.content-wrapper div.row { padding: 15px 0px; }
#reset { float: right; margin: 5px 2px 5px 0; }
.bc-chip { display: inline-block; padding: 2px 12px; border: 1px solid var(--ui-border); border-radius: 16px; background: var(--ui-row-hover-bg); color: var(--ui-text); }
.ui-bc-current .bc-chip { background: var(--ui-accent); color: var(--ui-on-accent); }
@@font-face {
font-family: 'e-bicons';
src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMj1wSfkAAAEoAAAAVmNtYXDnHOdpAAABmAAAAD5nbHlmSRvkRAAAAegAAANoaGVhZB2Xb78AAADQAAAANmhoZWEIUQQHAAAArAAAACRobXR4GAAAAAAAAYAAAAAYbG9jYQSCAv4AAAHYAAAADm1heHABFwEfAAABCAAAACBuYW1lXj/4/wAABVAAAAIlcG9zdE4LDloAAAd4AAAAegABAAAEAAAAAFwEAAAAAAAD9AABAAAAAAAAAAAAAAAAAAAABgABA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BuAGMAZgB1AHMAaQBvAG4AIABNAGUAdAByAG8AIABTAHQAdQBkAGkAbwB3AHcAdwAuAHMAeQBuAGMAZgB1AHMAaQBvAG4ALgBjAG8AbQAAAAACAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYBAgEDAQQBBQEGAQcAE2RvY3VtZW50LXNldHRpbmctd2YOZm9sZGVyLW9wZW4tMDERY2hldnJvbi1yaWdodF8wMy0KY2hlY2stbWFyawhob3VzZS0wNAAAAAA=) format('truetype');
font-weight: normal;
font-style: normal;
}
.e-bicons {
font-family: 'e-bicons' !important;
font-size: 14px;
}
.ui-breadcrumb-chips .e-chip-list {
padding: 0px;
}
.ui-breadcrumb-chips .e-chip-list .e-chip {
margin: 0px !important;
}
.ui-breadcrumb-chips .ui-bc-separator {
font-size: 20px;
}
.e-arrow:before {
content: "\e706";
font-weight: 800;
font-size: 12px;
}
.e-folder:before {
content: "\e704";
}
.e-file:before {
content: "\e703";
}
.e-custom-breadcrumb .e-custom-separator {
width: 5px;
background-color: #fff;
}
.e-custom-breadcrumb li + li {
padding-left: 0;
}
.e-custom-breadcrumb .e-custom-item {
width: auto;
height: 40px;
position: relative;
background: #938bf6;
padding: 10px 12px 10px 30px;
color: white;
cursor: pointer;
}
.e-custom-breadcrumb .ui-bc-item:last-child .e-custom-item {
cursor: default;
}
.e-custom-breadcrumb .e-custom-item:after {
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid white;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.e-custom-breadcrumb .e-custom-item:before {
content: "";
position: absolute;
right: -20px;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid #938bf6;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
z-index: 1;
}
.e-custom-breadcrumb li:first-child .e-custom-item:after {
border-left: 0;
}
.e-custom-breadcrumb li:first-child .e-custom-item {
border-top-left-radius: 25px;
border-bottom-left-radius: 25px;
padding: 10px 12px;
}
.e-custom-breadcrumb .e-custom-item:hover,
.e-custom-breadcrumb .e-custom-item:active {
background-color: #7b74ce;
}
.e-custom-breadcrumb .e-custom-item:hover::before,
.e-custom-breadcrumb .e-custom-item:active::before {
border-left: 20px solid #7b74ce;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.e-custom-breadcrumb .e-custom-icon .e-frame {
border-radius: 100%;
background-color: #7dd284;
border-color: #7dd284;
width: 18px;
height: 18px;
display: inline-block;
}
.e-custom-breadcrumb .e-custom-item .e-label {
vertical-align: top;
padding-left: 10px;
line-height: 1.5;
}
.e-custom-breadcrumb .e-custom-icon .e-frame::before {
content: "\e707";
font-size: 10px;
vertical-align: text-bottom;
margin-left: 4px
}
.e-custom-breadcrumb li:last-child .e-custom-icon .e-frame {
background-color: #c9c5fb;
border-color: #c9c5fb;
color: #938bf6;
}
.e-custom-breadcrumb .ui-bc-item,
.e-custom-breadcrumb .ui-bc-separator {
padding-right: 0px !important;
padding-left: 0px !important;
}
.e-custom-breadcrumb .e-custom-icon {
display: flex;
align-items: center;
}
.e-searchfor-text {
display: flex;
align-items: center;
font-size: 14px;
font-weight: normal;
}
.e-searchfor-text .ui-bc-text {
padding-left: 0;
}
.e-specific-item-template .ui-bc-item:last-child a:hover {
text-decoration: underline;
}
@@font-face {
font-family: 'e-bicons';
src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMj1wSfkAAAEoAAAAVmNtYXDnHOdpAAABmAAAAD5nbHlmSRvkRAAAAegAAANoaGVhZB2Xb78AAADQAAAANmhoZWEIUQQHAAAArAAAACRobXR4GAAAAAAAAYAAAAAYbG9jYQSCAv4AAAHYAAAADm1heHABFwEfAAABCAAAACBuYW1lXj/4/wAABVAAAAIlcG9zdE4LDloAAAd4AAAAegABAAAEAAAAAFwEAAAAAAAD9AABAAAAAAAAAAAAAAAAAAAABgABAAAAAQAA6q1k4F8PPPUACwQAAAAAAN1ClWcAAAAA3UKVZwAAAAAD9AP0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3AHcAdwAuAHMAeQBuAGMAZgB1AHMAaQBvAG4ALgBjAG8AbQAAAAACAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYBAgEDAQQBBQEGAQcAE2RvY3VtZW50LXNldHRpbmctd2YOZm9sZGVyLW9wZW4tMDERY2hldnJvbi1yaWdodF8wMy0KY2hlY2stbWFyawhob3VzZS0wNAAAAAA=) format('truetype');
font-weight: normal;
font-style: normal;
}
.e-bicons {
font-family: 'e-bicons' !important;
font-size: 14px;
}
.ui-breadcrumb-chips .e-chip-list {
padding: 0px;
}
.ui-breadcrumb-chips .e-chip-list .e-chip {
margin: 0px !important;
}
.ui-breadcrumb-chips .ui-bc-separator {
font-size: 20px;
}
.e-arrow:before {
font-weight: 800;
font-size: 12px;
}
.e-arrow:before {
content: "\e85f";
}
.e-folder:before {
content: "\e704";
}
.e-file:before {
content: "\e703";
}
.ui-breadcrumb-chips ol,
.e-custom-breadcrumb ol {
background-color: transparent !important;
}
.ui-breadcrumb-chips .ui-bc-item,
.ui-breadcrumb-chips .ui-bc-separator,
.e-custom-breadcrumb .ui-bc-item,
.e-custom-breadcrumb .ui-bc-separator {
padding-top: 0px !important;
padding-bottom: 0px !important;
}
.ui-breadcrumb-chips .ui-bc-item:not(:last-child):not(.ui-bc-separator):active,
.ui-breadcrumb-chips .ui-bc-item:not(:last-child):not(.ui-bc-separator):hover,
.e-custom-breadcrumb .ui-bc-item:not(:last-child):not(.ui-bc-separator):active,
.e-custom-breadcrumb .ui-bc-item:not(:last-child):not(.ui-bc-separator):hover {
background-color: transparent;
}
.ui-breadcrumb-chips .ui-bc-item:last-child .e-chip {
cursor: default;
}
.e-custom-breadcrumb .e-custom-separator {
width: 5px;
background-color: #fff;
}
.e-custom-breadcrumb li + li {
padding-left: 0;
}
.e-custom-breadcrumb .e-custom-item {
width: auto;
height: 40px;
position: relative;
background: #938bf6;
padding: 10px 12px 10px 30px;
color: white;
cursor: pointer;
}
.e-custom-breadcrumb .e-custom-item:after {
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid white;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.e-custom-breadcrumb .e-custom-item:before {
content: "";
position: absolute;
right: -20px;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid #938bf6;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
z-index: 1;
}
.e-custom-breadcrumb li:first-child .e-custom-item:after {
border-left: 0;
}
.e-custom-breadcrumb li:first-child .e-custom-item {
border-top-left-radius: 25px;
border-bottom-left-radius: 25px;
padding: 10px 12px;
}
.e-custom-breadcrumb .e-custom-item:hover,
.e-custom-breadcrumb .e-custom-item:active {
background-color: #7b74ce;
}
.e-custom-breadcrumb .e-custom-item:hover::before,
.e-custom-breadcrumb .e-custom-item:active::before {
border-left: 20px solid #7b74ce;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.e-custom-breadcrumb .e-custom-icon .e-frame {
border-radius: 100%;
background-color: #7dd284;
border-color: #7dd284;
width: 18px;
height: 18px;
display: inline-block;
}
.e-custom-breadcrumb .e-custom-item .e-bc-label {
vertical-align: top;
padding-left: 10px;
line-height: 1.5;
}
.e-custom-breadcrumb .e-custom-icon .e-frame::before {
content: "\e707";
font-size: 10px;
vertical-align: text-bottom;
margin-left: 4px
}
.e-custom-breadcrumb li:last-child .e-custom-icon .e-frame {
background-color: #c9c5fb;
border-color: #c9c5fb;
color: #938bf6;
}
.e-custom-breadcrumb .ui-bc-item,
.e-custom-breadcrumb .ui-bc-separator {
padding-right: 0px !important;
padding-left: 0px !important;
}
.e-custom-breadcrumb .e-custom-icon {
display: flex;
align-items: center;
}
.content-wrapper {
width: 90%;
margin: 0 auto;
min-width: 85px;
}
.content-wrapper div.row {
padding: 15px 0px;
}
</style>
<template id="chipTemplate"><span class="bc-chip">${text}</span></template>
<template id="specificItemTemplate"><span class="ui-bc-label">${text}</span></template>
<template id="customTemplate"><div class="e-custom-item"><div class="e-custom-icon"><span class="e-bicons e-frame e-check"></span><span class="e-label">${text}</span></div></div></template>
<template id="customSeparator"><span class="e-custom-separator"></span></template>
<template id="arrowSeparator"><span class="e-icons e-arrow"></span></template>
<div class="control-section">
<div class="content-wrapper">
<div class="row material2">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
<h5 style="display: inline-block">Custom Breadcrumb</h5>
@Html.UiButton(new UiButtonOptions { Id = "reset", Text = "Reset State", Size = UiInputSize.Small })
</div>
</div>
<div class="row material2">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
@Html.UiBreadcrumb(new UiBreadcrumbOptions { Id = "itemTemplate", CssClass = "e-breadcrumb-chips", ItemTemplate = "#chipTemplate", Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Cart" }, new UiBreadcrumbItem { Text = "Billing" }, new UiBreadcrumbItem { Text = "Shipping" }, new UiBreadcrumbItem { Text = "Payment" } } })
</div>
</div>
<div class="row material2">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
<h5>Specific Item Template</h5>
</div>
</div>
<div class="row material2">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
@Html.UiBreadcrumb(new UiBreadcrumbOptions { Id = "specific-item-template", CssClass = "e-specific-item-template", ItemTemplate = "#specificItemTemplate", OnBeforeItemRender = "specificItemRender", Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Home", Url = "https://ej2.syncfusion.com/home/aspnetmvc.html" }, new UiBreadcrumbItem { Text = "Components", Url = "https://ej2.syncfusion.com/aspnetmvc/grid/gridoverview" }, new UiBreadcrumbItem { Text = "Navigations", Url = "https://ej2.syncfusion.com/aspnetmvc/menu/defaultfunctionalities" }, new UiBreadcrumbItem { Text = "Breadcrumb", Url = "./defaultfunctionalities" } } })
</div>
</div>
<div class="row material2">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
<h5>Custom Separator</h5>
</div>
</div>
<div class="row material2">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
@Html.UiBreadcrumb(new UiBreadcrumbOptions { Id = "separatorTemplate", SeparatorTemplate = "#arrowSeparator", Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Cart" }, new UiBreadcrumbItem { Text = "Billing" }, new UiBreadcrumbItem { Text = "Shipping" }, new UiBreadcrumbItem { Text = "Payment" } } })
</div>
</div>
<div class="row material2">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
<h5>Custom Breadcrumb and Separator</h5>
</div>
</div>
<div class="row material2">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
@Html.UiBreadcrumb(new UiBreadcrumbOptions { Id = "bothTemplate", CssClass = "e-custom-breadcrumb", ItemTemplate = "#customTemplate", SeparatorTemplate = "#customSeparator", Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Cart" }, new UiBreadcrumbItem { Text = "Billing" }, new UiBreadcrumbItem { Text = "Shipping" }, new UiBreadcrumbItem { Text = "Payment" } } })
</div>
</div>
<div class="row material2">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
<h5>Breadcrumb with Icons</h5>
</div>
</div>
<div class="row material2">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
@Html.UiBreadcrumb(new UiBreadcrumbOptions { Id = "icon", Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Program Files", IconCss = "e-bicons e-folder" }, new UiBreadcrumbItem { Text = "Commom Files", IconCss = "e-bicons e-folder" }, new UiBreadcrumbItem { Text = "Services", IconCss = "e-bicons e-folder" }, new UiBreadcrumbItem { Text = "Config.json", IconCss = "e-bicons e-file" } } })
</div>
</div>
<div class="row material2">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
<h5>Disabled Breadcrumb</h5>
</div>
</div>
<div class="row material2">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
@Html.UiBreadcrumb(new UiBreadcrumbOptions { Id = "disabled", OnBeforeItemRender = "beforeItemRenderHandler", Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Program Files", IconCss = "e-bicons e-folder" }, new UiBreadcrumbItem { Text = "Commom Files", IconCss = "e-bicons e-folder" }, new UiBreadcrumbItem { Text = "Services", IconCss = "e-bicons e-folder" }, new UiBreadcrumbItem { Text = "Config.json", IconCss = "e-bicons e-file" } } })
</div>
</div>
</div>
</div>
<script>
// Syncfusion: the item template of the last item says what the page is searched for
function specificItemRender(args) {
if (args.item.text === 'Breadcrumb') {
args.element.querySelector('.ui-bc-text').insertAdjacentHTML('afterbegin', '<span class="e-searchfor-text" style="margin-right: 5px">Search for:</span>');
}
}
// Syncfusion: beforeItemRender disables every item but the first
function beforeItemRenderHandler(args) {
if (args.item.text !== 'Program Files') {
args.item.disabled = true;
}
}
document.getElementById('reset').addEventListener('click', function () {
document.querySelectorAll('.content-wrapper .ui-breadcrumb').forEach(function (breadcrumb) { window.Lumen.get(breadcrumb.id).reset(); });
});
</script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Lumen.UI.Mvc;
namespace YourApp.Controllers
{
public class BreadcrumbController : Controller
{
// The page is Views/Breadcrumb/TemplateAndCustomization.cshtml; it draws what ViewData holds.
public ActionResult TemplateAndCustomization()
{
return View();
}
}
}
@* Install once: Install-Package Lumen.UI.Mvc (or: dotnet add package Lumen.UI.Mvc) *@
@* Views/Web.config: <add namespace="Lumen.UI.Mvc" /> *@
@* Views/Shared/_Layout.cshtml *@
<head>
@Html.UiStyles()
<link rel="stylesheet" href="~/Content/site.css" />
</head>
<body>
@RenderBody()
@Html.UiScripts()
@RenderSection("scripts", required: false)
</body>
The Breadcrumb component provides a way to customize the items using ItemTemplate and the separators using SeparatorTemplate properties.
The icons are used for the visual representation of the breadcrumb items. You can specify the IconCss property to display the icon within the corresponding breadcrumb item. By default, the icons are aligned in the left position.
You can enable or disable the entire Breadcrumb using disabled property.
In this demo, we have used Shopping Cart details as Breadcrumb Items and customized the items using ItemTemplate and SeparatorTemplate.
And, showcased the file path of the config.json file with icons using the IconCss property and disabled the specific Breadcrumb items in beforeItemRender event using item disabled property.