angular/compose-with-tanstack-virtual

Compose TanStack Table with @tanstack/angular-virtual to render large row sets.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rendering very large TanStack Table datasets in Angular can become slow because the DOM mounts far more rows than the user can actually see.

Core Features & Use Cases

  • Compose TanStack Table with @tanstack/angular-virtual to render only the rows in the viewport (+ overscan) while TanStack Table stays headless and computes row/cell data.
  • Handle real-world table interactions such as sorting/filtering/grouping, variable row heights (via measuring), row expansion, and row selection keyed by row ID so state remains correct when rows scroll in and out of view.
  • Use correct layout mechanics including a fixed-height scroll container, a getTotalSize()-driven spacer height, and absolutely positioned rows with translateY to preserve accurate scrolling behavior.

Quick Start

Use the skill guidance to set a fixed-height scrolling container, compute rows = table.getRowModel().rows, create an Angular virtualizer using that row count, and render rowVirtualizer.getVirtualItems() with translateY(virtualRow.start) while setting the rows container height to rowVirtualizer.getTotalSize().

Frequently Asked Questions about angular/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 Angular to improve datagrid performance?

Virtualize TanStack Table rows in Angular by composing table rendering with @tanstack/angular-virtual to render only visible rows plus overscan. This keeps TanStack Table headless for data computation while using a fixed-height scroll container and absolute positioning to efficiently display large datasets.

Can I preserve row selection and expansion state when virtualizing rows in an Angular datagrid?

Yes, row selection and expansion state is preserved during virtualization by keying state to row IDs. This ensures state remains correct even when rows scroll in and out of view, maintaining accurate interactions across the virtualized dataset.

What's the best way to handle variable row heights when virtualizing an Angular table?

Handle variable row heights during virtualization by using the optional measureElement feature provided by the Angular virtualizer. This dynamically measures rendered row dimensions while still setting the container height to the virtualizer's getTotalSize() value.

Does virtualizing TanStack Table rows break sorting and filtering functionality?

No, sorting and filtering remain fully functional because TanStack Table stays headless and continues computing the row model. The virtualizer simply renders the output of table.getRowModel().rows, ensuring dynamic sorting and filtering updates reflect accurately in the virtualized viewport.

Why does my virtualized Angular table scroll incorrectly or fail to render rows?

Incorrect scrolling or missing rows in a virtualized Angular table often occurs when the scroll container lacks a fixed height or row positioning is not absolute with translateY. The container height must be set to virtualizer.getTotalSize() to preserve accurate scrolling behavior.

Do I need a fixed-height container to use TanStack virtual with Angular datagrids?

Yes, a fixed-height scroll container is required to use TanStack virtual with Angular datagrids. This establishes the viewport boundaries necessary for the virtualizer to calculate visible items and drive the translateY positioning of rows accurately.