Blazor Breadcrumb
Indicate the current page's location within a navigational hierarchy that automatically adds separators.
Examples #
<Breadcrumb Items="navItems1" />
<Breadcrumb Items="navItems2" />
@code {
private List<BreadcrumbItem>? navItems1;
private List<BreadcrumbItem>? navItems2;
protected override void OnInitialized()
{
navItems1 = new List<BreadcrumbItem>
{
new BreadcrumbItem{ Text = "Home", Href ="/" },
new BreadcrumbItem{ Text = "Breadcrumb", IsCurrentPage = true }
};
navItems2 = new List<BreadcrumbItem>
{
new BreadcrumbItem{ Text = "Home", Href ="/" },
new BreadcrumbItem{ Text = "Docs", Href ="/docs" },
new BreadcrumbItem{ Text = "Breadcrumb", IsCurrentPage = true }
};
}
}
Dividers #
<Breadcrumb style="--bs-breadcrumb-divider: '>';" Items="navItems" />
@code {
private List<BreadcrumbItem>? navItems;
protected override void OnInitialized()
{
navItems = new List<BreadcrumbItem>
{
new BreadcrumbItem{ Text = "Home", Href ="/" },
new BreadcrumbItem{ Text = "Docs", Href ="/docs" },
new BreadcrumbItem{ Text = "Breadcrumb", IsCurrentPage = true }
};
}
}
Embedded SVG icon #
<Breadcrumb style="--bs-breadcrumb-divider: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath d='M2.5 0L1 1.5 3.5 4 1 6.5 2.5 8l4-4-4-4z' fill='currentColor'/%3E%3C/svg%3E");" Items="navItems" />
@code {
private List<BreadcrumbItem>? navItems;
protected override void OnInitialized()
{
navItems = new List<BreadcrumbItem>
{
new BreadcrumbItem{ Text = "Home", Href ="/" },
new BreadcrumbItem{ Text = "Docs", Href ="/docs" },
new BreadcrumbItem{ Text = "Breadcrumb", IsCurrentPage = true }
};
}
}