tanstack-virtual
TanStack Virtual for virtualizing large lists, grids, and tables. Use when rendering thousands of rows, implementing infinite scroll, or optimizing large data displays. Use for virtual, virtualize, virtual-list, virtual-scroll, useVirtualizer, infinite-scroll, windowing.
What this skill does
# TanStack Virtual
## Overview
TanStack Virtual is a headless UI utility for virtualizing large lists, grids, and tables. It renders only the visible items in the viewport, dramatically reducing DOM nodes and improving performance for datasets with thousands of rows. Framework adapters are available for React, Vue, Solid, Svelte, Lit, and Angular.
**When to use:** Rendering thousands of rows or columns, building virtualized tables, implementing infinite scroll, displaying large datasets where DOM node count impacts performance.
**When NOT to use:** Small lists under ~100 items (no performance benefit), server-rendered static content, layouts where all items must be in the DOM for SEO or accessibility, simple pagination (render one page at a time instead).
## Quick Reference
| Pattern | API | Key Points |
| ------------------- | ----------------------------------------------------------- | -------------------------------------------------------- |
| Vertical list | `useVirtualizer({ count, getScrollElement, estimateSize })` | Wrap items in absolute-positioned container |
| Horizontal list | `useVirtualizer({ horizontal: true, ... })` | Use `getTotalSize()` for width instead of height |
| Grid layout | Row virtualizer + column virtualizer | Two virtualizer instances sharing one scroll element |
| Dynamic sizing | `ref={virtualizer.measureElement}` | Set `data-index` on each element |
| Window scroller | `useWindowVirtualizer({ count, estimateSize })` | No `getScrollElement` needed |
| Scroll to item | `virtualizer.scrollToIndex(index)` | Supports `align: 'start' \| 'center' \| 'end' \| 'auto'` |
| Scroll to offset | `virtualizer.scrollToOffset(px)` | Supports `align` and `behavior: 'smooth'` |
| Custom keys | `getItemKey: (index) => items[index].id` | Stable keys improve measurement cache |
| Overscan | `overscan: 5` | Renders extra items outside viewport (default: 1) |
| Gap between items | `gap: 8` | Space between virtualized items in pixels |
| Multi-lane layout | `lanes: 3` | Masonry-style column layouts |
| Padding | `paddingStart: 100, paddingEnd: 100` | Space before first and after last item |
| RTL support | `isRtl: true` | Right-to-left horizontal scrolling |
| Range extractor | `rangeExtractor: (range) => [...]` | Customize rendered indices (sticky headers, footers) |
| Disable virtualizer | `enabled: false` | Renders nothing, resets internal state |
| Force remeasure | `virtualizer.measure()` | Call after external layout changes |
## Common Mistakes
| Mistake | Correct Pattern |
| --------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| Missing `overflow: auto` on scroll container | Parent element must have `overflow: auto` and a fixed height/width |
| Using `virtualItem.index` as React key | Use `virtualItem.key` which accounts for dynamic reordering |
| Forgetting `position: relative` on inner container | The total-size container must be `position: relative` |
| Not setting `data-index` with `measureElement` | Dynamic measurement requires `data-index={virtualItem.index}` on each element |
| Setting `estimateSize` too small for dynamic items | Overestimate to prevent scroll jumping; use largest expected size |
| Recreating `getScrollElement` on every render | Use a ref callback: `() => parentRef.current` |
| Not using `getTotalSize()` for container dimensions | Inner container height/width must equal `virtualizer.getTotalSize()` |
| Absolute positioning without `transform` | Use `transform: translateY(item.start)` for GPU-accelerated positioning |
| Using `contain: strict` without fixed dimensions | `contain: strict` requires explicit width and height on the scroll container |
| Using with React Compiler without opting out | Add `'use no memo'` directive to components using `useVirtualizer` — interior mutability breaks memoization |
## Delegation
> If the `tanstack-table` skill is available, delegate data table virtualization to it. TanStack Table has built-in virtualization integration.
> Otherwise, recommend: `npx skills add oakoss/agent-skills --skill tanstack-table`
>
> If the `tanstack-query` skill is available, delegate data fetching and infinite query patterns to it.
> Otherwise, recommend: `npx skills add oakoss/agent-skills --skill tanstack-query`
## References
- [List virtualization with useVirtualizer](references/list-virtualization.md)
- [Grid virtualization with row and column virtualizers](references/grid-virtualization.md)
- [Dynamic sizing with measureElement](references/dynamic-sizing.md)
- [Infinite scroll with TanStack Query integration](references/infinite-scroll.md)
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.