Tesserae

VirtualizedList

Description

VirtualizedList is a collection component designed to efficiently render large sets of items by virtualizing the DOM content. Instead of rendering all items at once, it breaks the dataset into pages and only renders the pages within a defined “materialized window.” As the user scrolls, pages that move out of view are removed while new pages are dynamically added. This approach significantly reduces the number of DOM elements and improves performance, especially when list items involve complex or resource-intensive operations.

Usage

Instantiate the VirtualizedList using the provided static helper method from Tesserae.UI. You can set the list items and optionally provide a custom empty list message. The following example demonstrates how to create a VirtualizedList with a large set of items:

Methods

VirtualizedList WithEmptyMessage(Func emptyListMessageGenerator)

  • Description: Sets a custom empty message component to be displayed when the list does not contain any items.
  • Parameters:
    • emptyListMessageGenerator: A delegate that returns an IComponent to be rendered as the empty message.
  • Returns: The VirtualizedList instance.

VirtualizedList WithListItems(IEnumerable listItems)

  • Description: Populates the list with a collection of items. Internally, the items will be managed in pages for virtualization.
  • Parameters:
    • listItems: An enumerable collection of IComponent items to display.
  • Returns: The VirtualizedList instance.

HTMLElement Render()

  • Description: Renders the VirtualizedList component as an HTMLElement.
  • Returns: The rendered HTMLElement containing the virtualized list.

Public Properties

The VirtualizedList does not expose additional public properties. Its configuration is done through the method parameters during instantiation.

Samples

Basic Virtualized List

This sample demonstrates how to create a basic VirtualizedList component with a large set of items.

Virtualized List with Custom Empty Message

This sample shows how to provide a custom empty message when the list has no items.

See also

Referenced by

© 2026 Tesserae. All rights reserved.