Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Virtual List

ProNew

Draws only the rows in view, so a list of tens of thousands scrolls like a short one.

Installation

pnpm dlx shadcn@latest add @viewport/virtual-list

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
items*T[]—
rowHeight*number

The height of every row, in pixels. Rows must be the same height.

—
height*number

The height of the scrolling viewport, in pixels.

—
renderRow*(item: T, index: number) => React.ReactNode—
getId*(item: T, index: number) => string

A stable id for each item.

—
overscannumber

Extra rows drawn above and below the viewport, so fast scrolling does not show gaps.

6
label*string

Accessible name for the list.

—
classNamestring—

Accessibility

  • Native scrolling in a focusable, named list.
  • Each row states its position in the whole list.
  • Rows are placed with transforms, so scrolling never triggers layout.