What problem does it solve?
Virtualizing long lists, grids, and tables to avoid rendering offscreen DOM nodes and to maintain smooth scrolling and low memory usage even with very large datasets.
Core Features & Use Cases
- Minimal DOM footprint: Calculates visible items and positions them absolutely so the number of DOM nodes stays small regardless of data size.
- Flexible layouts: Supports vertical and horizontal lists, multi-lane grids, and combined row/column virtualizers for grids.
- Dynamic sizes & measurement: Handles variable item heights via element measurement and data-index attributes for accurate sizing.
- Advanced behaviors: Includes overscan, sticky items, window scrolling support, scroll-to APIs, smooth scrolling, and infinite-loading patterns.
- Use Case: Replace a paginated table with a virtualized grid that smoothly scrolls through tens of thousands of rows while loading additional pages on demand.
Quick Start
Install @tanstack/react-virtual and use useVirtualizer with a scroll container, count, getScrollElement, and estimateSize to render only visible rows.