DeepWorks Studios Blazor Component Library

Demo user Administrator ยท Blazor Server Library 20261206222504-6e8ff32.dirty

DwsBreadcrumb

A navigation trail showing where the current page sits in the site hierarchy. Its items are DwsLinks (a real href: middle click and Ctrl + click open a new tab), an item without an href and the "..." expander are DwsButtons, and the icons are DwsIcons. On a touch screen every item has a 44 px hit area.

API Reference

Basic

Items with an Href are links; the last item is the current page.

Show Code
Breadcrumb.razor
<DwsBreadcrumb Name="BreadcrumbDemo_Basic" Items="_basicItems" />
Breadcrumb.razor.cs
private readonly List<DwsBreadcrumbItem> _basicItems =
[
    new DwsBreadcrumbItem { Text = "Home", Href = "/" },
    new DwsBreadcrumbItem { Text = "Components", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Navigation", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Breadcrumb" },
];

Text separator

Separator replaces the default '/' with any string.

Show Code
Breadcrumb.razor
<DwsBreadcrumb Name="BreadcrumbDemo_SeparatorText" Items="_basicItems" Separator="›" />
Breadcrumb.razor.cs
private readonly List<DwsBreadcrumbItem> _basicItems =
[
    new DwsBreadcrumbItem { Text = "Home", Href = "/" },
    new DwsBreadcrumbItem { Text = "Components", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Navigation", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Breadcrumb" },
];

Icon separator

SeparatorIcon draws an icon between the items, coloured with SeparatorColor.

Show Code
Breadcrumb.razor
<DwsBreadcrumb Name="BreadcrumbDemo_SeparatorIcon" Items="_basicItems" SeparatorIcon="@Icons.BS.ChevronRight" SeparatorColor="DwsColor.Secondary" />
Breadcrumb.razor.cs
private readonly List<DwsBreadcrumbItem> _basicItems =
[
    new DwsBreadcrumbItem { Text = "Home", Href = "/" },
    new DwsBreadcrumbItem { Text = "Components", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Navigation", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Breadcrumb" },
];

Separator template

SeparatorTemplate renders any markup as the separator.

Show Code
Breadcrumb.razor
<DwsBreadcrumb Name="BreadcrumbDemo_SeparatorTemplate" Items="_basicItems">
    <SeparatorTemplate>
        @* Rendered once per separator: IgnorePermissionChecks keeps the repeated Name out of the page's registry. *@
        <DwsIcon Name="BreadcrumbDemo_SeparatorTemplate_Icon" IgnorePermissionChecks="true" Icon="@Icons.BS.ArrowRightCircleFill" Color="DwsColor.Secondary" Size="DwsSize.Small" />
    </SeparatorTemplate>
</DwsBreadcrumb>
Breadcrumb.razor.cs
private readonly List<DwsBreadcrumbItem> _basicItems =
[
    new DwsBreadcrumbItem { Text = "Home", Href = "/" },
    new DwsBreadcrumbItem { Text = "Components", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Navigation", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Breadcrumb" },
];

Icons

Give items an Icon; IconColor themes all of them.

Show Code
Breadcrumb.razor
<DwsBreadcrumb Name="BreadcrumbDemo_Icons" Items="_iconItems" IconColor="DwsColor.Accent" />
Breadcrumb.razor.cs
private readonly List<DwsBreadcrumbItem> _iconItems =
[
    new DwsBreadcrumbItem { Text = "Home", Href = "/", Icon = Icons.BS.HouseFill, Tag = "Home" },
    new DwsBreadcrumbItem { Text = "Library", Href = "/breadcrumb", Icon = Icons.BS.Book, Tag = "Library" },
    new DwsBreadcrumbItem { Text = "Folder", Href = "/breadcrumb", Icon = Icons.BS.Folder, Tag = "Folder" },
    new DwsBreadcrumbItem { Text = "Details", Icon = Icons.BS.InfoCircle, Tag = "Details" },
];

Item template

ItemTemplate takes over each item's content - clicks, disabled state and highlighting still apply.

Show Code
Breadcrumb.razor
<DwsBreadcrumb Name="BreadcrumbDemo_ItemTemplate" Items="_iconItems">
    <ItemTemplate Context="item">
        <DwsChip Name="@($"BreadcrumbDemo_ItemTemplate_{item.Tag}")" Text="@item.Text" Icon="@item.Icon" Appearance="DwsAppearance.Outline" Size="DwsSize.Small" />
    </ItemTemplate>
</DwsBreadcrumb>
Breadcrumb.razor.cs
private readonly List<DwsBreadcrumbItem> _iconItems =
[
    new DwsBreadcrumbItem { Text = "Home", Href = "/", Icon = Icons.BS.HouseFill, Tag = "Home" },
    new DwsBreadcrumbItem { Text = "Library", Href = "/breadcrumb", Icon = Icons.BS.Book, Tag = "Library" },
    new DwsBreadcrumbItem { Text = "Folder", Href = "/breadcrumb", Icon = Icons.BS.Folder, Tag = "Folder" },
    new DwsBreadcrumbItem { Text = "Details", Icon = Icons.BS.InfoCircle, Tag = "Details" },
];

Appearance and colour

Text, Outline and Filled appearances, themed through Color and ActiveItemColor.

Show Code
Breadcrumb.razor
<DwsBreadcrumb Name="BreadcrumbDemo_AppearanceText" Items="_basicItems" Appearance="DwsAppearance.Text" />
<DwsBreadcrumb Name="BreadcrumbDemo_AppearanceOutline" Items="_basicItems" Appearance="DwsAppearance.Outline" Color="DwsColor.Success" Class="mb-2" />
<DwsBreadcrumb Name="BreadcrumbDemo_AppearanceFilled" Items="_basicItems" Appearance="DwsAppearance.Filled" Color="DwsColor.Warning" ActiveItemColor="DwsColor.Error" />
Breadcrumb.razor.cs
private readonly List<DwsBreadcrumbItem> _basicItems =
[
    new DwsBreadcrumbItem { Text = "Home", Href = "/" },
    new DwsBreadcrumbItem { Text = "Components", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Navigation", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Breadcrumb" },
];

Sizes

The trail in every DwsSize.

Show Code
Breadcrumb.razor
@foreach (DwsSize size in Enum.GetValues<DwsSize>())
{
    <DwsBreadcrumb Name="@($"BreadcrumbDemo_Size_{size}")" Items="_basicItems" Size="size" Appearance="DwsAppearance.Filled" Class="mb-2" />
}
Breadcrumb.razor.cs
private readonly List<DwsBreadcrumbItem> _basicItems =
[
    new DwsBreadcrumbItem { Text = "Home", Href = "/" },
    new DwsBreadcrumbItem { Text = "Components", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Navigation", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Breadcrumb" },
];

Dimensions and spacing

Width, Height, Margin and Padding in px.

Show Code
Breadcrumb.razor
<DwsBreadcrumb Name="BreadcrumbDemo_Spacing" Items="_basicItems"
               Width="420" Height="56" Margin="8" Padding="12"
               Appearance="DwsAppearance.Filled" />
Breadcrumb.razor.cs
private readonly List<DwsBreadcrumbItem> _basicItems =
[
    new DwsBreadcrumbItem { Text = "Home", Href = "/" },
    new DwsBreadcrumbItem { Text = "Components", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Navigation", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Breadcrumb" },
];

Border and elevation

A themed border (BorderWidth, BorderStyle, BorderColor) and an Elevation shadow.

Show Code
Breadcrumb.razor
<DwsBreadcrumb Name="BreadcrumbDemo_BorderTrail" Items="_basicItems" Padding="8"
               BorderWidth="2" BorderStyle="DwsBorderStyle.Dashed" BorderColor="DwsColor.Primary"
               Elevation="2" />
Breadcrumb.razor.cs
private readonly List<DwsBreadcrumbItem> _basicItems =
[
    new DwsBreadcrumbItem { Text = "Home", Href = "/" },
    new DwsBreadcrumbItem { Text = "Components", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Navigation", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Breadcrumb" },
];

Active item: automatic

The last item is active by default; ActiveItemColor colours it.

Show Code
Breadcrumb.razor
<DwsBreadcrumb Name="BreadcrumbDemo_ActiveLast" Items="_basicItems" ActiveItemColor="DwsColor.Success" />
Breadcrumb.razor.cs
private readonly List<DwsBreadcrumbItem> _basicItems =
[
    new DwsBreadcrumbItem { Text = "Home", Href = "/" },
    new DwsBreadcrumbItem { Text = "Components", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Navigation", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Breadcrumb" },
];

Active item: explicit

Active = true marks one item as the active one, here the second.

Show Code
Breadcrumb.razor
<DwsBreadcrumb Name="BreadcrumbDemo_ActiveExplicit" Items="_explicitActiveItems" ActiveItemColor="DwsColor.Success" />
Breadcrumb.razor.cs
private readonly List<DwsBreadcrumbItem> _explicitActiveItems =
[
    new DwsBreadcrumbItem { Text = "Home", Href = "/" },
    new DwsBreadcrumbItem { Text = "Components", Href = "/breadcrumb", Active = true },
    new DwsBreadcrumbItem { Text = "Navigation", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Breadcrumb", Href = "/breadcrumb" },
];

Active item: current URL

ActiveMode.CurrentUrl marks the item whose Href is the current URL (this page is /breadcrumb).

Show Code
Breadcrumb.razor
<DwsBreadcrumb Name="BreadcrumbDemo_ActiveUrl" Items="_urlItems" ActiveMode="DwsBreadcrumbActiveMode.CurrentUrl" ActiveItemColor="DwsColor.Success" />
Breadcrumb.razor.cs
private readonly List<DwsBreadcrumbItem> _urlItems =
[
    new DwsBreadcrumbItem { Text = "Home", Href = "/" },
    new DwsBreadcrumbItem { Text = "Breadcrumb", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Link", Href = "/link" },
    new DwsBreadcrumbItem { Text = "Switch", Href = "/switch" },
];

No highlighting

HighlightActive=false drops the emphasis of the active item.

Show Code
Breadcrumb.razor
<DwsBreadcrumb Name="BreadcrumbDemo_ActiveNoHighlight" Items="_basicItems" HighlightActive="false" />
Breadcrumb.razor.cs
private readonly List<DwsBreadcrumbItem> _basicItems =
[
    new DwsBreadcrumbItem { Text = "Home", Href = "/" },
    new DwsBreadcrumbItem { Text = "Components", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Navigation", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Breadcrumb" },
];

Disabled trail

Disabled turns off the whole trail.

Show Code
Breadcrumb.razor
<DwsBreadcrumb Name="BreadcrumbDemo_DisabledAll" Items="_basicItems" Disabled="true" />
Breadcrumb.razor.cs
private readonly List<DwsBreadcrumbItem> _basicItems =
[
    new DwsBreadcrumbItem { Text = "Home", Href = "/" },
    new DwsBreadcrumbItem { Text = "Components", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Navigation", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Breadcrumb" },
];

Disabled item

DwsBreadcrumbItem.Disabled turns off a single item.

Show Code
Breadcrumb.razor
<DwsBreadcrumb Name="BreadcrumbDemo_DisabledItem" Items="_disabledItemItems" />
Breadcrumb.razor.cs
private readonly List<DwsBreadcrumbItem> _disabledItemItems =
[
    new DwsBreadcrumbItem { Text = "Home", Href = "/" },
    new DwsBreadcrumbItem { Text = "Archive (no access)", Href = "/breadcrumb", Disabled = true },
    new DwsBreadcrumbItem { Text = "Components", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Breadcrumb" },
];

Long items

MaxItemWidth cuts a long item's text with an ellipsis instead of letting it wrap; the full text is the item's tooltip. The second trail is the same one without the limit.

Show Code
Breadcrumb.razor
<DwsBreadcrumb Name="BreadcrumbDemo_LongItems" Items="_wordyItems" MaxItemWidth="160" />
<DwsBreadcrumb Name="BreadcrumbDemo_LongItemsWrapping" Items="_wordyItems" Class="mt-2" />
Breadcrumb.razor.cs
private readonly List<DwsBreadcrumbItem> _wordyItems =
[
    new DwsBreadcrumbItem { Text = "Home", Href = "/" },
    new DwsBreadcrumbItem { Text = "Quarterly reports and financial statements of the European subsidiaries", Href = "/breadcrumb" },
    new DwsBreadcrumbItem { Text = "Consolidated balance sheet, third quarter, preliminary version for the supervisory board" },
];

Interface-Description

Name Typ Default Description
DwsBreadcrumbItem.Text string string.Empty Label of the item.
DwsBreadcrumbItem.Href string? null Navigation target. An item without one is only clickable through OnItemClick.
DwsBreadcrumbItem.Icon string? null Icon class rendered before the text.
DwsBreadcrumbItem.Disabled bool false Renders the item as plain, non-clickable text.
DwsBreadcrumbItem.Active bool? null true marks the item active, overriding ActiveMode; false keeps ActiveMode from picking it.
DwsBreadcrumbItem.Tag object? null Arbitrary consumer data, handed back through OnItemClick.
Name Typ Parameters Description
Expand Task Shows every item of a collapsed trail.
Collapse Task Collapses the trail again according to MaxItems.
Name Typ Default Description
Items List<DwsBreadcrumbItem> [] The items of the trail, root first.
ItemTemplate RenderFragment<DwsBreadcrumbItem>? null Custom content for each item, rendered inside the item's link or text in place of its icon and text. Click handling, disabled state and highlighting still apply.
Separator string "/" Text rendered between two items. An empty string (with no SeparatorIcon or SeparatorTemplate) renders no separator.
SeparatorIcon string? null Icon class rendered between two items instead of Separator.
SeparatorTemplate RenderFragment? null Custom markup rendered between two items. Takes precedence over SeparatorIcon and Separator.
ExpanderTemplate RenderFragment? null Custom content of the button that stands in for collapsed items. Defaults to an ellipsis.
AriaLabel string? null Accessible name of the nav landmark. Defaults to the localised 'Breadcrumb'.
MaxItems int? null Collapses the trail once it holds more items than this. Left unset, the trail never collapses. The active item always stays visible, and a new Items list starts collapsed again.
ItemsBeforeCollapse int 1 Items kept visible before the expander when collapsed.
ItemsAfterCollapse int 1 Items kept visible after the expander when collapsed.
MaxItemWidth int? null Widest a single item's text may get, in px (never wider than the trail). A longer text is cut with an ellipsis and shown in full as the item's tooltip. Left unset, long items wrap. No effect on an ItemTemplate.
ActiveMode DwsBreadcrumbActiveMode DwsBreadcrumbActiveMode.LastItem Picks the active item when no item sets Active: the last item, the last item whose Href matches the current URL path, or none.
HighlightActive bool true Emphasises the active item (bold, ActiveItemColor). The active item keeps aria-current and stays unclickable either way.
ActiveItemColor DwsColor DwsColor.Undefined Text colour of the active item while HighlightActive is on.
Appearance DwsAppearance DwsAppearance.Text Text, Outline or Filled container.
Size DwsSize DwsSize.Medium Font size, spacing and padding preset.
Color DwsColor DwsColor.Primary Colour of the clickable items and accent of the Outline/Filled appearances.
SeparatorColor DwsColor DwsColor.Undefined Colour of the separators.
IconColor DwsColor DwsColor.Undefined Colour of the item icons.
BackgroundColor DwsColor DwsColor.Undefined Background colour of the container. Overrides the Filled tint.
Elevation int? null Drop-shadow depth from 0 (none) to 5.
Width int? null Width in px.
Height int? null Height in px.
Margin int? null Margin in px.
Padding int? null Padding in px. Overrides the Size preset's padding.
BorderWidth int? null Border width in px. Setting any border parameter draws a border; unset ones default to 1px solid.
BorderStyle DwsBorderStyle DwsBorderStyle.None Border style.
BorderColor DwsColor DwsColor.Undefined Border colour. Defaults to Color. On its own it draws a 1px solid border.
AnimationMode DwsBreadcrumbAnimationMode DwsBreadcrumbAnimationMode.None Entrance animation of items added to the trail (None, Fade, Slide). Skipped when the user prefers reduced motion.
AnimationSpeed DwsAnimationSpeed DwsAnimationSpeed.Normal Duration of the entrance animation.
NavigateOnClick bool true Navigates to the clicked item's Href after OnItemClick: each item is a DwsLink with a real href, so an internal page opens through DwsNavigation and Ctrl/Cmd/Shift-click or the middle button open a new tab (left to the browser). False: the items render no href and only raise OnItemClick (role=button links).
Name Typ Description
OnItemClick EventCallback<DwsBreadcrumbItem> Raised with the clicked item, before navigating. Items without Href become buttons while this is bound.
OnExpand EventCallback Raised when the user expands a collapsed trail. Keyboard focus moves to the first revealed item.
Name Typ Default Description
Element ElementReference The associated web component. May be null if accessed before the component is rendered.
ComponentGuid Guid Unique identifier for the component.
TypeString string The name of the component type, obtained from reflection.
Authorized_RegisterEnabled bool false Indicates whether this component is enabled through a permission registry.
Authorized_RegisterSelected bool false Indicates whether this component is selected in permission selection mode.
GetInitializedState bool false Returns whether the component is initialized.
GetRenderModeState DwsRenderMode Returns the current render mode.
GetComponentState DwsComponentStateType Returns the current component state.
GetIsInteractiveState bool false Returns whether the component is interactive.
GetIsPrerenderingState bool false Returns whether the component is prerendering.
GetComponentLoadingState bool false Returns whether the component is loading.
IsFormBusy bool false Whether the DwsForm (or DwsFormBusyRegion) around the component is locked because its submit handler is running. The state itself is the cascaded FormBusyState (IDwsFormBusyState).
Name Typ Parameters Description
DebugInfo void Logs debug information about the component.
UpdateState void Updates the component's state and triggers StateHasChanged.
UpdateStateAsync Task Asynchronously updates the component's state and triggers StateHasChanged.
Dispose void Disposes the component and releases resources.
FocusAsync ValueTask bool containedInScrollableList Sets focus to the component's element.
Name Typ Default Description
Name string Required unique identifier for the component within its container.
Visible bool true Determines if the component is visible in the UI.
Disabled bool false Disables the form control, ensuring it doesn't participate in form submission.
ComponentNameSpace string The namespace for permission-based access control.
PermissionKey string? null A stable key that takes the place of Name in the generated permission namespace (Page.PermissionKey): the stored permission survives a rename, and components that share a key share one permission entry. Null: keyed by Name. Read once, when the component registers; an explicit ComponentNameSpace wins.
Class string Optional CSS class names.
Style string Optional in-line styles.
Tag object An optional user-defined object to store any additional data with the component.
BackReference DwsReference A reference to the enclosing component.
ID string The HTML ID attribute for the component.
AdditionalAttributes Dictionary<string, object> Additional HTML attributes for the component's root element.
IgnorePermissionChecks bool false Bypasses all permission checks for this component.
IgnorePermissionSelection bool false Ignore permission selection mode for this component.
IgnoreFormBusy bool false Takes the component out of the submit lock of the DwsForm (or DwsFormBusyRegion) around it: IsFormBusy stays false for it.
Name Typ Description
OnInitializedCallbackStarted EventCallback Callback when OnInitialized starts.
OnInitializedCallback EventCallback Callback during OnInitialized.
OnInitializedCallbackCompleted EventCallback Callback when OnInitialized completes.
OnInitializedAsyncCallbackStarted EventCallback Callback when OnInitializedAsync starts.
OnInitializedAsyncCallback EventCallback Callback during OnInitializedAsync.
OnInitializedAsyncCallbackCompleted EventCallback Callback when OnInitializedAsync completes.
OnIsComponentLoadingChanged EventCallback<bool> Callback when IsComponentLoading changes.
OnCurrentRenderModeChanged EventCallback<DwsRenderMode> Callback when CurrentRenderMode changes.
OnComponentStateChanged EventCallback<DwsComponentStateType> Callback when ComponentState changes.
An error has occurred. This app may no longer respond until reloaded.