secondsky/claude-skills / plugins/tanstack-table/skills/tanstack-table
tanstack-table
VerifiedTanStack Table v8 headless data tables with server-side features for Cloudflare Workers + D1. Use for pagination, filtering, sorting, virtualization, or encountering state management, TanStack Query coordination, URL sync errors.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 22.1 KB |
| references/cloudflare-d1-examples.md | markdown | 3.4 KB |
| references/common-errors.md | markdown | 4.5 KB |
| references/feature-controls.md | markdown | 4.3 KB |
| references/performance-virtualization.md | markdown | 2.4 KB |
| references/query-integration.md | markdown | 5.1 KB |
| references/server-side-patterns.md | markdown | 8.9 KB |
| templates/basic-client-table.tsx | other | 2.7 KB |
| templates/column-configuration.tsx | other | 4.1 KB |
| templates/controlled-table-state.tsx | other | 9.0 KB |
| templates/d1-database-example.tsx | other | 9.2 KB |
| templates/package.json | manifest | 631 B |
| templates/server-paginated-table.tsx | other | 6.2 KB |
| templates/shadcn-styled-table.tsx | other | 3.2 KB |
| templates/virtualized-large-dataset.tsx | other | 4.7 KB |
references/performance-virtualization.md
View on GitHub# Performance & Virtualization
Guide to optimizing TanStack Table for large datasets using TanStack Virtual.
## When to Virtualize
- **Client-side tables with 1000+ rows**
- **Scrolling feels slow or janky**
- **Browser runs out of memory**
- **Need to render 10k+ rows efficiently**
## TanStack Virtual Basics
```bash
npm install @tanstack/react-virtual
```
```typescript
import { useVirtualizer } from '@tanstack/react-virtual'
import { useRef } from 'react'
function VirtualizedTable() {
const containerRef = useRef<HTMLDivElement>(null)
const rowVirtualizer = useVirtualizer({
count: rows.length, // Total number of rows
getScrollElement: () => containerRef.current, // Scroll container
estimateSize: () => 50, // Estimated row height
overscan: 10, // Extra rows to render (smooth scrolling)
})
return (
<div ref={containerRef} style={{ height: '600px', overflow: 'auto' }}>
{/* Only render visible rows */}
{rowVirtualizer.getVirtualItems().map(virtualRow => {
const row = rows[virtualRow.index]
return <tr key={row.id}>{/* ... */}</tr>
})}
</div>
)
}
```
## Complete Example
See `templates/virtualized-large-dataset.tsx`
## Performance Tips
### 1. Memoize Data and Columns
```typescript
// BAD: New array every render
const data = [...]
// GOOD: Stable reference
const data = useMemo(() => [...], [])
```
### 2. Use Column Sizes
```typescript
const columns = [
{ accessorKey: 'id', header: 'ID', size: 80 }, // Fixed width
{ accessorKey: 'name', header: 'Name' }, // Flexible
]
```
### 3. Avoid Heavy Cell Renderers
```typescript
// BAD: Complex logic in every cell
cell: info => <ExpensiveComponent data={info.getValue()} />
// GOOD: Memoized component
const MemoizedCell = React.memo(ExpensiveComponent)
cell: info => <MemoizedCell data={info.getValue()} />
```
### 4. Enable Row Selection Carefully
```typescript
// Only if needed - adds overhead
enableRowSelection: true,
```
### 5. Use Server-Side for Very Large Data
If dataset >10k rows, consider server-side pagination instead of virtualization.
## Measuring Performance
```typescript
import { Profiler } from 'react'
<Profiler id="Table" onRender={(id, phase, actualDuration) => {
console.log(`${id} ${phase} took ${actualDuration}ms`)
}}>
<MyTable />
</Profiler>
```
## Further Reading
- [TanStack Virtual Docs](https://tanstack.com/virtual/latest)
- [Complete Example](../templates/virtualized-large-dataset.tsx)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |