Blazor Breadcrumb
Blazor Bootstrap breadcrumb component indicates the current page's location within a navigational hierarchy that automatically adds separators.
Parameters
Name | Type | Default | Required | Description | Added Version |
---|---|---|---|---|---|
Items | List<BreadcrumbItem> | null | ✔️ | Gets or sets the items. | 1.0.0 |
Examples
Breadcrumb
<div>
<Breadcrumb Items="NavItems1"></Breadcrumb>
<Breadcrumb Items="NavItems2"></Breadcrumb>
</div>
@code {
private List<BreadcrumbItem> NavItems1 { get; set; }
private List<BreadcrumbItem> NavItems2 { get; set; }
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
Dividers are automatically added in CSS through ::before
and content
. They can be changed by modifying a local CSS custom property --bs-breadcrumb-divider.
<div>
<Breadcrumb style="--bs-breadcrumb-divider: '>';" Items="NavItems2"></Breadcrumb>
</div>
@code {
private List<BreadcrumbItem> NavItems2 { get; set; }
protected override void OnInitialized()
{
NavItems2 = new List<BreadcrumbItem>
{
new BreadcrumbItem{ Text = "Home", Href ="/" },
new BreadcrumbItem{ Text = "Docs", Href ="/docs" },
new BreadcrumbItem{ Text = "Breadcrumb", IsCurrentPage = true }
};
}
}
See breadcrumb with dividers demo here.
Embedded SVG icon
It's also possible to use an embedded SVG icon. Apply it via our CSS custom property
<div>
<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="NavItems2"></Breadcrumb>
</div>
@code {
private List<BreadcrumbItem> NavItems2 { get; set; }
protected override void OnInitialized()
{
NavItems2 = new List<BreadcrumbItem>
{
new BreadcrumbItem{ Text = "Home", Href ="/" },
new BreadcrumbItem{ Text = "Docs", Href ="/docs" },
new BreadcrumbItem{ Text = "Breadcrumb", IsCurrentPage = true }
};
}
}