VirtualList

A list that renders only the items in and around its scroll viewport, for large collections with fixed-height rows.

The slot is rendered once per visible item, with the item and its index passed back as $slot.item and $slot.index. DataGrid has its own virtualization; use VirtualList for simpler lists.

Structure

<VirtualList items={rows} itemHeight={32} height={240} ariaLabel="Rows">
	<div>{$slot.item.label}</div>
</VirtualList>

Set height for a fixed viewport, or omit it to measure the element. overscan controls how many extra rows are rendered above and below the viewport.

Demo