Example of Overflow Modes in ASP.NET MVC Breadcrumb Control
This sample demonstrates the different types of overflow mode such as Hidden, Menu, Wrap, Collapsed, and Scroll in the Breadcrumb component.
Overflow Mode - Hidden
Overflow Mode - Menu
Overflow Mode - Collapsed
Overflow Mode - Wrap
Overflow Mode - Scroll
@Html.UiButton(new UiButtonOptions { Id = "reset", Text = "Reset State", Size = UiInputSize.Small })
@Html.UiBreadcrumb(new UiBreadcrumbOptions { Id = "default-mode", MaxItems = 3, OnItemClick = "noNavigation", OverflowMode = UiBreadcrumbOverflowMode.Hidden, Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Home", Url = "./" }, new UiBreadcrumbItem { Text = "Breadcrumb", Url = "./breadcrumb" }, new UiBreadcrumbItem { Text = "Default", Url = "./breadcrumb/default-functionalities" }, new UiBreadcrumbItem { Text = "Icons", Url = "./breadcrumb/icons" }, new UiBreadcrumbItem { Text = "Navigation", Url = "./breadcrumb/navigation" }, new UiBreadcrumbItem { Text = "Overflow", Url = "./breadcrumb/overflow" } } })
@Html.UiBreadcrumb(new UiBreadcrumbOptions { Id = "menu-mode", MaxItems = 3, OnItemClick = "noNavigation", OverflowMode = UiBreadcrumbOverflowMode.Menu, Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Home", Url = "./" }, new UiBreadcrumbItem { Text = "Breadcrumb", Url = "./breadcrumb" }, new UiBreadcrumbItem { Text = "Default", Url = "./breadcrumb/default-functionalities" }, new UiBreadcrumbItem { Text = "Icons", Url = "./breadcrumb/icons" }, new UiBreadcrumbItem { Text = "Navigation", Url = "./breadcrumb/navigation" }, new UiBreadcrumbItem { Text = "Overflow", Url = "./breadcrumb/overflow" } } })
@Html.UiBreadcrumb(new UiBreadcrumbOptions { Id = "collapsed-mode", MaxItems = 3, OnItemClick = "noNavigation", OverflowMode = UiBreadcrumbOverflowMode.Collapsed, Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Home", Url = "./" }, new UiBreadcrumbItem { Text = "Breadcrumb", Url = "./breadcrumb" }, new UiBreadcrumbItem { Text = "Default", Url = "./breadcrumb/default-functionalities" }, new UiBreadcrumbItem { Text = "Icons", Url = "./breadcrumb/icons" }, new UiBreadcrumbItem { Text = "Navigation", Url = "./breadcrumb/navigation" }, new UiBreadcrumbItem { Text = "Overflow", Url = "./breadcrumb/overflow" } } })
@Html.UiBreadcrumb(new UiBreadcrumbOptions { Id = "wrap-mode", MaxItems = 3, OnItemClick = "noNavigation", OverflowMode = UiBreadcrumbOverflowMode.Wrap, Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Home", Url = "./" }, new UiBreadcrumbItem { Text = "Breadcrumb", Url = "./breadcrumb" }, new UiBreadcrumbItem { Text = "Default", Url = "./breadcrumb/default-functionalities" }, new UiBreadcrumbItem { Text = "Icons", Url = "./breadcrumb/icons" }, new UiBreadcrumbItem { Text = "Navigation", Url = "./breadcrumb/navigation" }, new UiBreadcrumbItem { Text = "Overflow", Url = "./breadcrumb/overflow" } } })
@Html.UiBreadcrumb(new UiBreadcrumbOptions { Id = "scroll-mode", MaxItems = 3, OnItemClick = "noNavigation", OverflowMode = UiBreadcrumbOverflowMode.Scroll, Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Home", Url = "./" }, new UiBreadcrumbItem { Text = "Breadcrumb", Url = "./breadcrumb" }, new UiBreadcrumbItem { Text = "Default", Url = "./breadcrumb/default-functionalities" }, new UiBreadcrumbItem { Text = "Icons", Url = "./breadcrumb/icons" }, new UiBreadcrumbItem { Text = "Navigation", Url = "./breadcrumb/navigation" }, new UiBreadcrumbItem { Text = "Overflow", Url = "./breadcrumb/overflow" } } })
<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; }
.content-wrapper {
width: 90%;
margin: 0 auto;
min-width: 85px;
}
.content-wrapper div.row {
padding: 15px 0px;
}
.content-wrapper div.row:nth-child(even) {
padding-top: 0;
}
</style>
<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">Overflow Mode - Hidden</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 = "default-mode", MaxItems = 3, OnItemClick = "noNavigation", OverflowMode = UiBreadcrumbOverflowMode.Hidden, Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Home", Url = "./" }, new UiBreadcrumbItem { Text = "Breadcrumb", Url = "./breadcrumb" }, new UiBreadcrumbItem { Text = "Default", Url = "./breadcrumb/default-functionalities" }, new UiBreadcrumbItem { Text = "Icons", Url = "./breadcrumb/icons" }, new UiBreadcrumbItem { Text = "Navigation", Url = "./breadcrumb/navigation" }, new UiBreadcrumbItem { Text = "Overflow", Url = "./breadcrumb/overflow" } } })
</div>
</div>
<div class="row material2">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
<h5>Overflow Mode - Menu</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 = "menu-mode", MaxItems = 3, OnItemClick = "noNavigation", OverflowMode = UiBreadcrumbOverflowMode.Menu, Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Home", Url = "./" }, new UiBreadcrumbItem { Text = "Breadcrumb", Url = "./breadcrumb" }, new UiBreadcrumbItem { Text = "Default", Url = "./breadcrumb/default-functionalities" }, new UiBreadcrumbItem { Text = "Icons", Url = "./breadcrumb/icons" }, new UiBreadcrumbItem { Text = "Navigation", Url = "./breadcrumb/navigation" }, new UiBreadcrumbItem { Text = "Overflow", Url = "./breadcrumb/overflow" } } })
</div>
</div>
<div class="row material2">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
<h5>Overflow Mode - Collapsed</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 = "collapsed-mode", MaxItems = 3, OnItemClick = "noNavigation", OverflowMode = UiBreadcrumbOverflowMode.Collapsed, Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Home", Url = "./" }, new UiBreadcrumbItem { Text = "Breadcrumb", Url = "./breadcrumb" }, new UiBreadcrumbItem { Text = "Default", Url = "./breadcrumb/default-functionalities" }, new UiBreadcrumbItem { Text = "Icons", Url = "./breadcrumb/icons" }, new UiBreadcrumbItem { Text = "Navigation", Url = "./breadcrumb/navigation" }, new UiBreadcrumbItem { Text = "Overflow", Url = "./breadcrumb/overflow" } } })
</div>
</div>
<div class="row material2">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
<h5>Overflow Mode - Wrap</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 = "wrap-mode", MaxItems = 3, OnItemClick = "noNavigation", OverflowMode = UiBreadcrumbOverflowMode.Wrap, Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Home", Url = "./" }, new UiBreadcrumbItem { Text = "Breadcrumb", Url = "./breadcrumb" }, new UiBreadcrumbItem { Text = "Default", Url = "./breadcrumb/default-functionalities" }, new UiBreadcrumbItem { Text = "Icons", Url = "./breadcrumb/icons" }, new UiBreadcrumbItem { Text = "Navigation", Url = "./breadcrumb/navigation" }, new UiBreadcrumbItem { Text = "Overflow", Url = "./breadcrumb/overflow" } } })
</div>
</div>
<div class="row material2">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
<h5>Overflow Mode - Scroll</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 = "scroll-mode", MaxItems = 3, OnItemClick = "noNavigation", OverflowMode = UiBreadcrumbOverflowMode.Scroll, Items = new List<UiBreadcrumbItem> { new UiBreadcrumbItem { Text = "Home", Url = "./" }, new UiBreadcrumbItem { Text = "Breadcrumb", Url = "./breadcrumb" }, new UiBreadcrumbItem { Text = "Default", Url = "./breadcrumb/default-functionalities" }, new UiBreadcrumbItem { Text = "Icons", Url = "./breadcrumb/icons" }, new UiBreadcrumbItem { Text = "Navigation", Url = "./breadcrumb/navigation" }, new UiBreadcrumbItem { Text = "Overflow", Url = "./breadcrumb/overflow" } } })
</div>
</div>
</div>
</div>
<script>
// Syncfusion: Reset State sets every Breadcrumb of the page back as it was first drawn
document.getElementById('reset').addEventListener('click', function () {
document.querySelectorAll('.content-wrapper .ui-breadcrumb').forEach(function (breadcrumb) { window.Lumen.get(breadcrumb.id).reset(); });
});
// Syncfusion: enableNavigation is false, so a click on an item only raises the event
function noNavigation() { return false; }
</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/OverFlowModes.cshtml; it draws what ViewData holds.
public ActionResult OverFlowModes()
{
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>
Overflow mode limits the number of items to be displayed in the view when the breadcrumb's width exceeds the container width or maxItems property.
The following overflow mode's were available in the Breadcrumb component.
Hidden- Specified maxItems count will be visible and the remaining items will be hidden. While clicking on the previous item, the hidden item will become visible.Collapsed- Only the first and last items will be visible, and the remaining items will be hidden with collapsed icon. When the collapsed icon is clicked, all the items become visible.Menu- Shows the number of breadcrumb items that can be accommodated within the container space, and creates a sub menu with the remaining items.Wrap- Wraps the items on multiple lines when the Breadcrumb�s width exceeds the container space.Scroll- Shows an HTML scroll bar when the Breadcrumb�s width exceeds the container space.None- Shows all the items on a single line.