Breadcrumb

in namespace DotVVM.Controls.Tailwind.Controls

Renders a breadcrumb navigation built from MenuItem definitions.

Usage & Scenarios

Renders breadcrumb navigation from hard-coded MenuItem children or a bound DataSource. In data-bound mode, use the Item* mappings to configure text, templates, commands, URLs, icons, and route navigation.

Sample 1: Basic Breadcrumb

Shows hard-coded breadcrumb items using MenuItem children. The sample uses NavigateUrl, Icon, and IsActive with URLs that stay inside the sample app.

<t:Breadcrumb>
    <t:MenuItem Text="Home" Icon="Home" NavigateUrl="?section=home" />
    <t:MenuItem Text="Controls" NavigateUrl="?section=controls" />
    <t:MenuItem Text="Breadcrumbs" NavigateUrl="?section=breadcrumbs" />
    <t:MenuItem Text="Current page" IsActive="true" />
</t:Breadcrumb>

Sample 2: Data-bound Breadcrumb (ItemTemplate)

Generates breadcrumb items from a collection and formats each label with ItemTemplate. In data-bound mode, the template replaces ItemText.

<t:Breadcrumb DataSource="{value: BreadcrumbItems}"
              ItemNavigateUrl="{value: Url}"
              ItemIsActive="{value: IsActive}">
    <ItemTemplate>
        <span class="font-medium">{{value: Text}}</span>
    </ItemTemplate>
</t:Breadcrumb>
using System.Collections.Generic;
using DotVVM.Framework.ViewModel;

public class ViewModel : DotvvmViewModelBase
{
    public List<BreadcrumbItemData> BreadcrumbItems { get; set; } = new()
    {
        new() { Text = "Home", Url = "?step=home" },
        new() { Text = "Products", Url = "?step=products" },
        new() { Text = "Details", Url = "?step=details", IsActive = true }
    };

    public class BreadcrumbItemData
    {
        public string Text { get; set; } = "";
        public string Url { get; set; } = "";
        public bool IsActive { get; set; }
    }
}

Sample 3: Data-bound Breadcrumb (command links)

Uses ItemText and ItemClick to generate breadcrumb items that invoke a command instead of navigating away. This is useful when the breadcrumb should change viewmodel state inside the current page.

<div class="flex flex-col gap-3">
    <t:Breadcrumb DataSource="{value: Actions}"
                  ItemText="{value: Text}"
                  ItemClick="{command: _parent.Select(Text)}" />
    <p>Last clicked item: <strong>{{value: LastSelected}}</strong></p>
</div>
using System.Collections.Generic;
using DotVVM.Framework.ViewModel;

public class ViewModel : DotvvmViewModelBase
{
    public List<BreadcrumbActionData> Actions { get; set; } = new()
    {
        new() { Text = "Catalog" },
        new() { Text = "Details" },
        new() { Text = "Review" }
    };

    public string LastSelected { get; set; } = "Catalog";

    public void Select(string text)
    {
        LastSelected = text;
    }

    public class BreadcrumbActionData
    {
        public string Text { get; set; } = "";
    }
}

Sample 4: Breadcrumb with RouteName

Uses RouteName on MenuItem children to navigate between pages registered inside the generated sample app.

<t:Breadcrumb>
    <t:MenuItem Text="Overview" RouteName="SampleA" IsActive="true" />
    <t:MenuItem Text="Details" RouteName="SampleB" />
</t:Breadcrumb>

<p>Overview page in the sample app. Use the breadcrumb to navigate to the details page.</p>
<t:Breadcrumb>
    <t:MenuItem Text="Overview" RouteName="SampleA" />
    <t:MenuItem Text="Details" RouteName="SampleB" IsActive="true" />
</t:Breadcrumb>

<p>Details page in the sample app. The breadcrumb stays inside the generated sample application.</p>

Properties

Name Type Description Notes Default Value
property icon DataSource IValueBinding<IEnumerable<Object>> Gets or sets the collection used to generate breadcrumb items.
attribute
inner element
static value
bindable
default
null
property icon ItemCulture String Gets or sets the culture used when generating each breadcrumb route URL.
attribute
inner element
static value
bindable
default
null
property icon ItemIcon HeroIcon? Gets or sets the icon displayed before each generated breadcrumb item label.
attribute
inner element
static value
bindable
default
null
property icon ItemIsActive Boolean Gets or sets whether each generated breadcrumb item represents the current page.
attribute
inner element
static value
bindable
default
False
property icon ItemNavigateUrl String Gets or sets the target URL for each generated breadcrumb item.
attribute
inner element
static value
bindable
default
null
property icon ItemRouteName String Gets or sets the DotVVM route name for each generated breadcrumb item.
attribute
inner element
static value
bindable
default
null
property icon Items List<MenuItem> Gets or sets hardcoded children.
attribute
inner element
static value
bindable
default
null
property icon ItemTemplate ITemplate Gets or sets a custom label template for each generated breadcrumb item.
attribute
inner element
static value
bindable
default
null
property icon ItemText String Gets or sets the text displayed for each generated breadcrumb item.
attribute
inner element
static value
bindable
default
null
property icon ItemUrlSuffix String Gets or sets the URL suffix appended to each generated route link.
attribute
inner element
static value
bindable
default
null
property icon Visible Boolean Gets or sets whether the control is visible. When set to false, `style="display: none"` will be added to this control.
attribute
inner element
static value
bindable
default
True

Events

Name Type Description
event icon ItemClick ICommandBinding Gets or sets the command invoked when a generated breadcrumb item is clicked.

HTML produced by the control