Tesserae

ItemsList

Description

ItemsList is a flexible list component designed for displaying small sets of items. It belongs to the Collections group and can render items in different layouts depending on the specified columns. When provided with multiple columns, it renders the items using a grid layout; if fewer than two columns are provided, it falls back to a horizontal stack layout. This component is ideal for scenarios where you want to display items without the overhead of virtualization, and it supports customizing the message shown when the list is empty.

Usage

The ItemsList component can be instantiated using the static helper methods provided by the Tesserae.UI class. It accepts either an array of IComponent items or an ObservableList along with one or more column width definitions (of type UnitSize). If the columns are more than one, a grid layout is used; otherwise, a stack layout is used.

Below is a basic example of how to create an ItemsList:

API reference

class

ItemsList

public sealed class ItemsList : IComponent, ISpecialCaseStyling

A simple, non-virtualised vertical list of arbitrary items, used when a would be overkill.

Constructors

Constructor
ItemsList
public ItemsList(IComponent[] items, params UnitSize[] columns) : this(new ObservableList<IComponent>(initialValues: items ?? new IComponent[0]), columns)

Initializes a new instance of this class.

Constructor
ItemsList
public ItemsList(ObservableList<IComponent> items, params UnitSize[] columns)

Initializes a new instance of this class.

Properties

Property
ItemsList.Items
public ObservableList<IComponent> Items { get; }

Adds the given items to the component.

Property
ItemsList.StylingContainer
public HTMLElement StylingContainer

Gets or sets the styling container.

Property
ItemsList.PropagateToStackItemParent
public bool PropagateToStackItemParent

Gets or sets the propagate to stack item parent.

Methods

Method
ItemsList.WithEmptyMessage
public ItemsList WithEmptyMessage(Func<IComponent> emptyListMessageGenerator)

Returns the component configured with the given empty message.

Method
ItemsList.Render
public HTMLElement Render()

Renders the component's root HTML element.

Samples

Basic ItemsList with Single Column

This sample renders 12 cards stacked vertically. With a single column width (100%) ItemsList uses a stack layout; the container scrolls when the items exceed the visible area.

Multi-column Grid Layout with Varied Widths

Passing multiple column widths switches the layout to a grid. Mixing fixed and fractional widths shows how ItemsList handles responsive sizing.

Empty-state Customization

When the list contains no items, WithEmptyMessage controls the placeholder. The delegate is rendered inline so it can include any Tesserae component, including action buttons.

See Also

  • VirtualizedList – For handling larger sets of items efficiently.
  • Grid – Related layout component used in multi-column scenarios.
  • Stack – Alternative layout when using a single column display.
© 2026 Tesserae. All rights reserved.