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:

Methods

  • WithEmptyMessage(Func emptyListMessageGenerator)
    • Description: Specifies a custom message component that is displayed when the list has no items.
    • Parameters:
      • emptyListMessageGenerator: A function that returns an IComponent. This component is used as the empty list message.
    • Returns: The same ItemsList instance to allow for fluent chaining.

Properties

  • ObservableList Items
    • Description: Holds the collection of items that will be rendered by the ItemsList component. You can modify this list dynamically to update what is rendered.
  • HTMLElement StylingContainer
    • Description: Exposes the underlying container element for styling purposes.
  • bool PropagateToStackItemParent
    • Description: Indicates whether additional styling or behavior should be propagated to parent elements in the stack layout. This is useful when integrating with other Tesserae components.

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.