svelte/compose-with-tanstack-virtual

Compose TanStack Table with TanStack Virtual for row virtualization in Svelte.

28.3k|3.6k|Updated Oct 20, 2016
One-click install
npx skills add https://github.com/TanStack/table --skill svelte-compose-with-tanstack-virtual
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: svelte/compose-with-tanstack-virtual
Source: https://github.com/TanStack/table/tree/main/packages/svelte-table/skills/svelte/compose-with-tanstack-virtual
Command: npx skills add https://github.com/TanStack/table --skill svelte-compose-with-tanstack-virtual

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TanStack Table renders the full row model for your grid, which can become slow and heavy when you have thousands of rows or expensive per-row markup. This skill shows how to pair TanStack Table with TanStack Virtual so only the visible window is rendered.

Core Features & Use Cases

  • Row virtualization with TanStack Virtual: Render only $rowVirtualizer.getVirtualItems() and position rows with transform: translateY(...) inside a container sized by getTotalSize().
  • Dynamic row heights support: Use measureElement to handle variable-height rows (and guard against Firefox measurement quirks).
  • Additional patterns: Apply the same approach for horizontal (column) virtualization and implement infinite scrolling by loading more when nearing the end.

Quick Start

Ask your agent to explain and implement row virtualization by combining table.getRowModel().rows with createVirtualizer in Svelte, then rendering only the virtual items positioned by translateY within a fixed-height scroll container.

Frequently Asked Questions about svelte/compose-with-tanstack-virtual

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I virtualize TanStack Table rows in Svelte to render large datasets efficiently?

Virtualize TanStack Table rows in Svelte by wiring the virtualizer count to `table.getRowModel().rows.length`, rendering only `getVirtualItems()`, and positioning rows with CSS `translateY` transforms inside a fixed-height scroll container sized by `getTotalSize()`.

Can I implement infinite scrolling with TanStack Virtual and Svelte?

You can implement infinite scrolling with TanStack Virtual in Svelte by detecting when the user scrolls near the end of the visible virtual items and triggering a data fetch to load more rows into the underlying TanStack Table model.

How do I handle dynamic row heights when using virtual scroll in Svelte?

Handle dynamic row heights in a Svelte virtual scroll by using the virtualizer's `measureElement` method and adding a `data-index` attribute to row elements, which allows accurate measurement of variable-height rows while guarding against Firefox measurement quirks.

Does TanStack Virtual support horizontal column virtualization in Svelte tables?

TanStack Virtual supports horizontal column virtualization in Svelte tables by applying the same virtualization logic used for rows to the column axis, rendering only the visible columns within the scroll container.

Why is my Svelte virtual scroll table slow with thousands of rows?

Svelte tables become slow with thousands of rows because the full row model is rendered in the DOM; pairing TanStack Table with TanStack Virtual limits rendering to only the visible window, significantly improving scroll performance.