Esta página se muestra en inglés. Una traducción al español está en curso.
ConfigsMay 30, 2026·3 min de lectura

TanStack Virtual — Headless UI for Virtualizing Large Lists

A headless, framework-agnostic library for efficiently rendering massive lists and grids by only mounting visible rows, supporting React, Vue, Solid, and Svelte.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
TanStack Virtual
Comando de instalación directa
npx -y tokrepo@latest install 3404f139-5c65-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con dry-run.

Introduction

TanStack Virtual is a headless virtualization library that renders only the visible portion of large lists, tables, and grids. It keeps DOM node count low regardless of data size, preventing performance degradation when scrolling through thousands or millions of rows.

What TanStack Virtual Does

  • Virtualizes vertical lists, horizontal lists, and 2D grids
  • Renders only visible items plus a configurable overscan buffer
  • Supports dynamic row heights with automatic measurement
  • Works with React, Vue, Solid, and Svelte via framework adapters
  • Provides smooth scrolling with estimated sizes and measurement callbacks

Architecture Overview

The core virtualizer is a framework-agnostic state machine that tracks the scroll container, calculates which items are visible, and returns measurement data. Framework adapters like @tanstack/react-virtual wrap this core with hooks or composables. The library does not render any DOM — it returns positional data (offset, size, index) that you apply to your own elements, making it fully headless.

Self-Hosting & Configuration

  • Install the adapter for your framework: @tanstack/react-virtual, @tanstack/vue-virtual, etc.
  • Provide a scroll container ref, item count, and an estimateSize function
  • Map over virtualizer.getVirtualItems() to render only visible rows
  • Position items absolutely using the start offset from each virtual item
  • Enable measureElement for dynamic sizes that adjust after render

Key Features

  • Renders only visible items for lists of any size without lag
  • Supports variable and dynamic item heights with auto-measurement
  • Horizontal and grid virtualization for two-dimensional layouts
  • Headless design gives full control over markup and styling
  • Tiny bundle size with zero dependencies beyond the TanStack core

Comparison with Similar Tools

  • react-window — React-only, with fixed and variable size list components; TanStack Virtual is headless and multi-framework
  • react-virtualized — older, larger library with many features; TanStack Virtual is lighter and more modern
  • vue-virtual-scroller — Vue-specific; TanStack Virtual supports Vue, React, Solid, and Svelte
  • Virtua — newer alternative with similar goals; TanStack Virtual has deeper TanStack ecosystem integration
  • Native scroll — works for small lists but chokes on 10K+ items; virtualization is essential at scale

FAQ

Q: What frameworks are supported? A: React, Vue, Solid, and Svelte each have dedicated adapter packages.

Q: Can I virtualize a grid? A: Yes. Create two virtualizers (row and column) and combine their measurements for 2D virtualization.

Q: Does it handle dynamic row heights? A: Yes. Pass measureElement to measure items after rendering and the virtualizer adjusts automatically.

Q: How does it compare to react-window? A: TanStack Virtual is headless, supports multiple frameworks, and handles dynamic sizes more naturally.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados