Frontend & UISûr100100/100
With Tanstack Virtual (TanStack) — React Table
Virtualize final React Table row or column models with TanStack Virtual. Load for useVirtualizer counts, scroll elements, stable keys, data-index measurement, dynamic heights, sticky headers/columns, grid/flex geometry, or infinite fetching; Virtual is renderer composition, not a Table feature.
ou envoie-le directement à ton agent.
Installer dans ton projet
$ curl -fsSL https://arboristhree.xyz/cli/install-skill.mjs -o /tmp/arboris-install-skill.mjs && node /tmp/arboris-install-skill.mjs with-tanstack-virtual__tanstack-table__packages-react-table-skills-0810b0ab2a8dTanStack
TanStack/table
Contenu à copier
---
name: with-tanstack-virtual
description: >
Virtualize final React Table row or column models with TanStack Virtual. Load for useVirtualizer counts, scroll elements, stable keys, data-index measurement, dynamic heights, sticky headers/columns, grid/flex geometry, or infinite fetching; Virtual is renderer composition, not a Table feature.
metadata:
origin: TanStack
type: composition
library: '@tanstack/react-table'
library_version: '9.2.4'
framework: react
requires:
- '@tanstack/table-core#core'
- getting-started
- table-state
sources:
- 'TanStack/table:docs/framework/react/guide/virtualization.md'
- 'TanStack/table:examples/react/virtualized-rows'
- 'TanStack/table:examples/react/virtualized-columns'
- 'TanStack/table:examples/react/virtualized-infinite-scrolling'
---
This skill builds on `@tanstack/table-core#core`, `getting-started`, and `table-state`. Build the Table model first, then virtualize its final rendered rows or visible columns.
## Setup
```tsx
import { useRef } from 'react'
import { useVirtualizer } from '@tanstack/react-virtual'
function VirtualBody({ table }: { table: any }) {
const scrollRef = useRef<HTMLDivElement>(null)
const rows = table.getRowModel().rows
const virtualizer = useVirtualizer({
count: rows.length,
getScrollElement: () => scrollRef.current,
estimateSize: () => 36,
getItemKey: (index) => rows[index].id,
overscan: 5,
})
return (
<div ref={scrollRef} style={{ height: 400, overflow: 'auto' }}>
<div style={{ height: virtualizer.getTotalSize(), position: 'relative' }}>
{virtualizer.getVirtualItems().map((item) => (
<div
key={rows[item.index].id}
data-index={item.index}
ref={virtualizer.measureElement}
style={{
position: 'absolute',
transform: `translateY(${item.start}px)`,
width: '100%',
}}
>
{rows[item.index].getAllCells().map((cell: any) => (
<span
key={cell.id}
style={{
display: 'inline-block',
width: cell.column.getSize(),
}}
>
<table.FlexRender cell={cell} />
</span>
))}
</div>
))}
</div>
</div>
)
}
```
## Core Patterns
### Keep the virtualizer near its render loop
```tsx
const rows = table.getRowModel().rows
const rowVirtualizer = useVirtualizer({
count: rows.length,
getScrollElement: () => container.current,
estimateSize: () => 36,
})
```
This limits unrelated parent updates and keeps count, measurement, and rendered items together.
### Use Table sizes in renderer CSS
```tsx
<td style={{ width: cell.column.getSize() }}>
<table.FlexRender cell={cell} />
</td>
```
Table calculates size state; the renderer must apply it.
## Common Mistakes
### HIGH Registering Virtual as a feature
Wrong:
```tsx
const features = tableFeatures({ rowVirtualizer: useVirtualizer(options) })
```
Correct:
```tsx
const rows = table.getRowModel().rows
const virtualizer = useVirtualizer({
count: rows.length,
getScrollElement: () => scrollRef.current,
estimateSize: () => 36,
})
```
Virtual controls rendering geometry and is not a Table feature or row model.
Source: `docs/framework/react/guide/virtualization.md`
### HIGH Virtualizing raw input data
Wrong:
```tsx
const virtualizer = useVirtualizer({
count: data.length,
getScrollElement,
estimateSize,
})
```
Correct:
```tsx
const rows = table.getRowModel().rows
const virtualizer = useVirtualizer({
count: rows.length,
getScrollElement,
estimateSize,
})
```
Raw data ignores filtering, sorting, expansion, grouping, and pagination already applied by Table.
Source: `examples/react/virtualized-rows`
### HIGH Measuring against incomplete identity
Wrong:
```tsx
<tr ref={virtualizer.measureElement}>{row.id}</tr>
```
Correct:
```tsx
<tr key={row.id} data-index={item.index} ref={virtualizer.measureElement}>
{row.id}
</tr>
```
Dynamic measurement needs the virtual index, and stable row identity prevents measurements moving to the wrong row.
Source: `examples/react/virtualized-rows`
### HIGH Omitting positioning geometry
Wrong:
```tsx
<tbody>{virtualizer.getVirtualItems().map(renderRow)}</tbody>
```
Correct:
```tsx
<tbody
style={{
display: 'grid',
height: virtualizer.getTotalSize(),
position: 'relative',
}}
>
{virtualizer.getVirtualItems().map(renderRow)}
</tbody>
```
Virtual only computes positions; the renderer must provide total spacer size and position items using each virtual start.
Source: `examples/react/virtualized-rows`
## API Discovery
Inspect `node_modules/@tanstack/react-table/dist/index.d.ts` for Table render APIs and installed `node_modules/@tanstack/react-virtual/dist/` for the exact virtualizer options. Copy layout contracts from the maintained example matching rows, columns, or infinite loading.Colle ce Markdown dans ton agent ou utilise les boutons ci-dessus pour l’écrire dans ton projet.
Ce que fait With Tanstack Virtual (TanStack) — React Table
Applique les pratiques du skill with-tanstack-virtual__tanstack-table__packages-react-table-skills-0810b0ab2a8d.
Comment utiliser With Tanstack Virtual (TanStack) — React Table
1
Copie le prompt
Un clic copie le prompt packagé (ou l'envoie à ton agent).
2
L'agent installe le skill
Il ajoute le SKILL.md et ses ressources à ton projet.
3
Activation automatique
Le skill s'active dès que le contexte correspond.
Déclencheurs pour With Tanstack Virtual (TanStack) — React Table
Dis simplement à ton agent quelque chose comme :
Applique le skill with-tanstack-virtual__tanstack-table__packages-react-table-skills-0810b0ab2a8d à cette tâche
Utilise with-tanstack-virtual__tanstack-table__packages-react-table-skills-0810b0ab2a8d pour améliorer cette implémentation
Passe en revue ce sujet avec with-tanstack-virtual__tanstack-table__packages-react-table-skills-0810b0ab2a8d
Skills liés à With Tanstack Virtual (TanStack) — React Table
accessibility
Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels, accessibility traits and hints, focus management, contrast, target size, and screen-reader support. Use when building or auditing UI for accessibility compliance, keyboard navigation, or screen-reader support.Accessibility Pass (Microsoft)
Use this skill whenever the user asks to check, review, or fix the accessibility of a PowerPoint deck, Word document, HTML page, or Markdown file, and before handing over any deck or document this agent just generated, so it does not ship with missing alt text, untitled slides, or unreadable colour contrast.Add Connector (Microsoft)
Use when adding a Power Platform connector to an Expo/React Native Power Apps mobile app and no dedicated mobile connector skill exists.