Provides TanStack Virtual headless virtualization for React. Use when rendering large lists (100+ items), implementing virtual scroll, building infinite scroll feeds, virtualizing grids or tables, using window-level scrolling, or implementing masonry/lane layouts.
Ships in frontend. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
npm install @tanstack/react-virtual
Three required options — everything else is optional:
count — total item count
getScrollElement — () => scrollableElement
estimateSize — (index) => number (px)
You must:
getTotalSize()virtualItem.startimport { useRef } from 'react'
import { useVirtualizer } from '@tanstack/react-virtual'
function List({ items }: { items: string[] }) {
const parentRef = useRef<HTMLDivElement>(null)
const virtualizer = useVirtualizer({
count: items.length,
getScrollElement: () => parentRef.current,
estimateSize: () => 35,
})
return (
<div ref={parentRef} style={{ height: '400px', overflow: 'auto' }}>
<div style={{ height: `${virtualizer.getTotalSize()}px`, position: 'relative' }}>
{virtualizer.getVirtualItems().map((item) => (
<div
key={item.key}
style={{
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: `${item.size}px`,
transform: `translateY(${item.start}px)`,
}}
>
{items[item.index]}
</div>
))}
</div>
</div>
)
}
const virtualizer = useVirtualizer({
count: items.length,
getScrollElement: () => parentRef.current,
estimateSize: () => 100, // err large for better scroll-to-index accuracy
})
{virtualizer.getVirtualItems().map((item) => (
<div
key={item.key}
data-index={item.index} // required for measureElement
ref={virtualizer.measureElement} // measures on mount/resize
style={{
position: 'absolute',
top: 0,
left: 0,
width: '100%',
transform: `translateY(${item.start}px)`,
// Do NOT set height — virtualizer controls it
}}
>
{items[item.index]}
</div>
))}
import { useRef, useEffect } from 'react'
import { useWindowVirtualizer } from '@tanstack/react-virtual'
function WindowList({ items }: { items: string[] }) {
const listRef = useRef<HTMLDivElement>(null)
const virtualizer = useWindowVirtualizer({
count: items.length,
estimateSize: () => 35,
scrollMargin: listRef.current?.offsetTop ?? 0,
})
return (
<div ref={listRef}>
<div style={{ height: `${virtualizer.getTotalSize()}px`, position: 'relative' }}>
{virtualizer.getVirtualItems().map((item) => (
<div
key={item.key}
style={{
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: `${item.size}px`,
transform: `translateY(${item.start - virtualizer.options.scrollMargin}px)`,
}}
>
{items[item.index]}
</div>
))}
</div>
</div>
)
}
scrollMargin = distance from page top to list top. Subtract it from item.start in the transform.
virtualizer.scrollToIndex(50, { align: 'start' }) // 'start' | 'center' | 'end' | 'auto'
virtualizer.scrollToOffset(1200, { behavior: 'smooth' })
Always:
overflow: auto on scroll containerheight/width on scroll containerposition: relative on inner container sized to getTotalSize()position: absolute on each virtual itemtranslateY/translateX for positioning (not top/left)data-index on items when using measureElementitem.key as React key (not item.index)scrollMargin for window virtualizers when content precedes the listNever:
height on dynamically measured itemsoverflow: auto on scroll containersmooth scroll behavior with dynamic-size items (documented limitation)| Option | Default | Purpose |
|---|---|---|
overscan | 1 | Extra items rendered outside visible area |
gap | 0 | Spacing between items (px) — use instead of CSS margin |
paddingStart | 0 | Padding before first item (px) |
paddingEnd | 0 | Padding after last item (px) |
horizontal | false | Horizontal orientation |
lanes | 1 | Columns (vertical) or rows (horizontal) for masonry |
getItemKey | index | Stable item keys — always set when items have IDs |
enabled | true | Set false to disable observers and reset state |
isRtl | false | RTL horizontal scroll |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
34 skills in this plugin
/ai-sdkAnswer questions about the AI SDK and help build AI-powered features. Use when developers: (1) Ask about AI SDK functions like generateText, streamText, ToolLoopAgent, embed, or tools, (2) Want to build AI agents, chatbots, RAG systems, or text generation features, (3) Have questions about AI providers (OpenAI, Anthropic, Google, etc.), streaming, tool calling, structured output, or embeddings, (4) Use React hooks like useChat or useCompletion. Triggers on: "AI SDK", "Vercel AI SDK", "generateText", "streamText", "add AI to my app", "build an agent", "tool calling", "structured output", "useChat"./baseline-uiQuickly deslop UI code by fixing spacing, hierarchy, typography, and small layout issues. Use when the interface needs a fast cleanup or polish pass./Other plugins' skills for the same job
/frontend:tanstack-virtualfrom frontend
npx claudepluginhub fellipeutaka/leon --plugin frontend