OverflowSet
Description
The OverflowSet component is a container designed to manage a set of UI items that may overflow the available display space. It automatically computes item widths and, when necessary, collapses excess items into an overflow menu (shown as a chevron button). Use this component when you need to display a dynamic list of elements that must adapt to constrained widths.
Usage
Instantiate the OverflowSet using the fluent interface provided by Tesserae.UI. Items can be added using the Items() method, which accepts multiple IComponent instances. The component automatically adds separators between items. Configure properties such as the overflow index or switch to a small variant using dedicated methods or properties.
Below is a minimal example demonstrating how to create an OverflowSet with several button items:
API reference
public class OverflowSet : IComponent, IContainer<Breadcrumb, IComponent>A horizontal set of items where any items that do not fit are automatically collapsed into an overflow menu.
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 OverflowSet JustifyContent(ItemJustify justify)Sets the justify-content css property for this set
Parameters
- justify
public void Replace(IComponent newComponent, IComponent oldComponent)Replaces an existing item with a new one.
public OverflowSet Items(params IComponent[] children)Adds the given items to the component.
public OverflowSet DisableSizeCache()Disables the size cache on the component.
public OverflowSet SetOverflowIndex(int i)Sets the overflow index of the component.
Samples
Basic OverflowSet Example
In this sample, an OverflowSet is created with multiple button items. When the display area is constrained, excess items will collapse into an overflow menu rendered as a chevron button.