Virtual List

A React virtual list that renders only the rows in view, with fixed or measured row heights, overscan, arrow key and Page Up/Down navigation and a scrollToIndex handle.

src/registry/ui/virtual-list.tsx/r/virtual-list.json

Installation#

bash
npx shadcn@latest add @minidev/virtual-list

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/virtual-list.json

Usage#

tsx
import { VirtualList } from "@/components/ui/virtual-list"

export function Example() {
  return <VirtualList />
}

API reference#

VirtualList props
PropTypeDefault
itemsT[]SAMPLE_INVOICES as unknown as T[]
rowHeightnumber | "auto"40
estimatedRowHeightnumber40
overscannumber6
heightnumber360
renderRow(item: T, index: number, state: { active: boolean }) => React.ReactNodedefaultRender
getKey(item: T, index: number) => React.KeydefaultKey
describeRow(item: T, index: number) => stringdefaultDescribe
activeIndexnumber-
defaultActiveIndexnumber0
onActiveChange(index: number) => void-
onSelect(item: T, index: number) => void-
titlestring"Invoices"
showJumpbooleantrue
showFooterbooleantrue
refReact.Ref<VirtualListHandle>-
aria-labelstring-
classNamestring-

Dependencies#

npm

lucide-react

Built from

No other MiniDev files
All data table components

Learn more