Breadcrumb
Description
The Breadcrumb component is used to display a navigational trail, indicating the user's current page within a hierarchical structure. It is part of the Collections group and is ideal for showing navigational contexts in an application, allowing users to quickly jump back to higher level categories. Breadcrumbs are typically placed below the main navigation area to provide quick access to previous pages or sections.
Usage
Instantiate the Breadcrumb component using the static helper method from Tesserae.UI. You can add individual breadcrumb items using the fluent interface. Each breadcrumb item is created using the helper method Crumb(string text), which can be further customized with event handlers such as OnClick and Disabled.
Below is a sample code demonstrating how to create a simple Breadcrumb component with several items:
API reference
public class Breadcrumb : IComponent, IContainer<Breadcrumb, IComponent>A navigational trail showing the user's position within a hierarchy of pages or sections.
Properties
public int MaximumItemsToDisplay { get ; set ; }Gets or sets the maximum items to display.
public int OverflowIndex { get ; set ; }Gets or sets the overflow index.
Methods
public void Replace(IComponent newComponent, IComponent oldComponent)Replaces an existing item with a new one.
public Breadcrumb Items(params IComponent[] children)Adds the given items to the component.
public Breadcrumb DisableSizeCache()Disables the size cache on the component.
public Breadcrumb SetOverflowIndex(int i)Sets the overflow index of the component.
public Breadcrumb SetChevron(UIcons icon)Sets the chevron of the component.
Samples
Deep Breadcrumb with Click Events
This sample demonstrates a deep breadcrumb hierarchy with click handlers. Each click updates the "Selected" label so you can verify event handling.
Collapsed Breadcrumb with Custom Chevron
With a constrained MaxWidth, the breadcrumb collapses extra levels behind an overflow menu. Here we also swap the default separator for a custom chevron and pin the overflow to start after the first item.
Small Breadcrumb with Custom Separator
A compact breadcrumb uses Small() for tighter spacing and accepts any UIcons value as separator. The last item omits the click handler so it acts as a non-interactive current-page marker.
See also
- Stack – A layout container useful for stacking components vertically.
- ItemsList – A collection component for displaying lists of items.