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#
| Prop | Type | Default |
|---|---|---|
items | T[] | SAMPLE_INVOICES as unknown as T[] |
rowHeight | number | "auto" | 40 |
estimatedRowHeight | number | 40 |
overscan | number | 6 |
height | number | 360 |
renderRow | (item: T, index: number, state: { active: boolean }) => React.ReactNode | defaultRender |
getKey | (item: T, index: number) => React.Key | defaultKey |
describeRow | (item: T, index: number) => string | defaultDescribe |
activeIndex | number | - |
defaultActiveIndex | number | 0 |
onActiveChange | (index: number) => void | - |
onSelect | (item: T, index: number) => void | - |
title | string | "Invoices" |
showJump | boolean | true |
showFooter | boolean | true |
ref | React.Ref<VirtualListHandle> | - |
aria-label | string | - |
className | string | - |
Dependencies#
npm
lucide-react
Built from
No other MiniDev files
Related tables components#
Audit Filter BarFilter toolbar for audit logs combining a search field, actor filter chips for all, admins or system, and a date range picker in one wrapping row.Audit Log EntrySingle audit log line: actor avatar, actor name, muted action text and the affected target, with a relative timestamp underneath. Stacks into a trail.Audit TrailBordered audit trail in React that renders a list of actor, action, target and time records as stacked log entries. Useful for security and admin history pages.Bulk Actions BarFloating Tailwind selection bar that appears once rows are selected, showing the count, your action buttons and a clear button. Sticks to the bottom edge.Column Visibility MenuColumns dropdown for data tables with a checkbox item per column. It returns the updated list of visible column ids so you can show or hide table columns.Data TableReact data table with sortable columns, row selection, a floating bulk actions bar, hover row actions, sticky header, three densities and skeleton loading.
All data table components