Table of Contents

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

items IReadOnlyList<T>

Source collection. Must not be null.

keySelector Func<T, string>

Selector that derives a stable per-item key. Must not be null.

itemHeight float

Fixed height (pixels) used for layout and visible-range calculation.

renderer Func<T, VNode>

Function that produces a VNode for each visible item. Must not be null.

overscan int

Extra items rendered above/below the visible window to smooth scroll-in.

key string

Key used to disambiguate siblings at the same position.

className string

CSS-like utility class string. Multiple classes separated by spaces.

name string

Element name assigned to UnityEngine.UIElements.VisualElement.name for query/debug.

Returns

VirtualListNode

The created VirtualListNode.

Type Parameters

T

Element type of the source collection.