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:
Methods
- WithEmptyMessage(Func
emptyListMessageGenerator) - Description: Sets a function that generates a message/component to be displayed when the list is empty.
- Parameters:
- emptyListMessageGenerator: A function that returns an IComponent used as an empty list message.
- Returns: The current instance of InfiniteScrollingList to allow method chaining.
Properties
StylingContainer (HTMLElement)
- Description: Returns the HTML element that serves as the container for styling purposes.
PropagateToStackItemParent (bool)
- Description: A flag indicating whether styling or properties should propagate to the parent of each stack item. Returns true.
Samples
Basic Infinite Scrolling List (Stack)
This sample demonstrates a basic infinite scrolling list where items are added dynamically as the user scrolls. The component uses a vertically stacked layout when a single column width is provided.
Infinite Scrolling Grid List
This sample sets up an infinite scrolling grid list, specifying different widths for each column to create a grid layout.