Method VirtualList
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
VirtualList<T>(IReadOnlyList<T>, Func<T, string>, float, Func<T, VNode>, int, string?, string?, string?)
Virtualized list component for rendering large item collections. Renders a fixed-height-item ScrollView and only places the visible range in the DOM (a virtualized list).
public static VirtualListNode VirtualList<T>(IReadOnlyList<T> items, Func<T, string> keySelector, float itemHeight, Func<T, VNode> renderer, int overscan = 3, string? key = null, string? className = null, string? name = null)
Parameters
itemsIReadOnlyList<T>Source collection. Must not be null.
keySelectorFunc<T, string>Selector that derives a stable per-item key. Must not be null.
itemHeightfloatFixed height (pixels) used for layout and visible-range calculation.
rendererFunc<T, VNode>Function that produces a VNode for each visible item. Must not be null.
overscanintExtra items rendered above/below the visible window to smooth scroll-in.
keystringKey used to disambiguate siblings at the same position.
classNamestringCSS-like utility class string. Multiple classes separated by spaces.
namestringElement name assigned to UnityEngine.UIElements.VisualElement.name for query/debug.
Returns
- VirtualListNode
The created VirtualListNode.
Type Parameters
TElement type of the source collection.