InfiniteScrollingList
Description
InfiniteScrollingList is a dynamic component designed to display a paginated list of UI elements that loads additional content as the user scrolls. It supports both list (stack) and grid layouts depending on the number of columns provided. Use this component when you need to render items in small to moderate quantity with an infinite scrolling experience. For extremely large datasets, consider using VirtualizedList.
Usage
Initialize the InfiniteScrollingList using one of the overloaded factory methods from the Tesserae.UI helper. You provide an initial set of items (optionally empty) and an asynchronous function that returns the next page of items. Optionally, you can pass multiple UnitSize values to establish a grid layout. The component automatically appends a VisibilitySensor that triggers fetching additional items when nearing the bottom of the list.
Below is an example that instantiates an InfiniteScrollingList in a simple list mode:
API reference
public sealed class InfiniteScrollingList : IComponent, ISpecialCaseStylingA list that lazily loads additional items as the user scrolls toward the bottom, suitable for very large or unbounded result sets.
Constructors
public InfiniteScrollingList(Func<IComponent[]> getNextItemPage, params UnitSize[] columns) : this(new IComponent[0], () => Task.FromResult<IComponent[]>(getNextItemPage()), columns)Initializes a new instance of this class.
public InfiniteScrollingList(IComponent[] items, Func<IComponent[]> getNextItemPage, params UnitSize[] columns) : this(items, () => Task.FromResult<IComponent[]>(getNextItemPage()), columns)Initializes a new instance of this class.
public InfiniteScrollingList(Func<Task<IComponent[]>> getNextItemPage, params UnitSize[] columns) : this(new IComponent[0], getNextItemPage, columns)Initializes a new instance of this class.
Properties
public HTMLElement StylingContainerGets or sets the styling container.
Methods
public InfiniteScrollingList WithEmptyMessage(Func<IComponent> emptyListMessageGenerator)Returns the component configured with the given empty message.
Samples
Infinite Scrolling Stack with Async Loading
Each time the visibility sensor at the bottom of the list comes into view, the loader awaits a simulated network call and returns the next page of 15 items. Scroll to the bottom — the page counter advances and the newly loaded items are appended.
Infinite Scrolling Grid Layout
By passing more than one column width to InfiniteScrollingList, the same async-loaded items are laid out as a responsive grid. This sample uses three 33%-width columns.