
Description
Wire columnResizingFeature, header.getResizeHandler, resize mode and direction, pointer or touch events, and performant CSS-variable updates. Load when resize state changes but widths do not, or large tables resize slowly.
SKILL.md
This skill builds on core, table-features, and column-sizing. Resizing supplies gesture APIs and state; the renderer supplies handles and widths.
Setup
import {
columnResizingFeature,
columnSizingFeature,
tableFeatures,
} from '@tanstack/table-core'
export const features = tableFeatures({
columnSizingFeature,
columnResizingFeature,
})
export const options = {
columnResizeMode: 'onChange' as const,
columnResizeDirection: 'ltr' as const,
}
Core Patterns
const handler = header.getResizeHandler()
handle.addEventListener('mousedown', handler)
handle.addEventListener('touchstart', handler)
For large grids, compute all visible sizes once per update and expose them as CSS variables.
Common Mistakes
CRITICAL Omitting sizing prerequisite
Wrong: tableFeatures({ columnResizingFeature })
Correct: tableFeatures({ columnSizingFeature, columnResizingFeature })
Resizing modifies the sizing state and requires columnSizingFeature.
Source: packages/table-core/src/types/TableFeatures.ts#FeatureSlotPrereqs
HIGH Rendering an inert handle
Wrong: handle.addEventListener('pointerdown', header.getResizeHandler())
Correct:
const handler = header.getResizeHandler()
handle.addEventListener('mousedown', handler)
handle.addEventListener('touchstart', handler)
The shipped handler distinguishes touchstart from the mouse path. A single
pointerdown listener does not provide working touch resizing; wire both mouse
and touch start events.
Source: docs/framework/react/guide/column-resizing.md#connect-column-resizing-apis-to-ui
MEDIUM Reading sizes in every cell
Wrong: cells.forEach(cell => cell.style.width = ${cell.column.getSize()}px)
Correct: root.style.setProperty(--col-${header.id}, ${header.getSize()}px)
Caching sizes or CSS variables avoids repeated work during onChange resizing.
Source: examples/react/column-resizing-performant/src/main.tsx
API Discovery
Inspect node_modules/@tanstack/table-core/dist/features/column-resizing/ and the sizing feature directory for the state it updates.
More skills from the table repository
View all 30 skillsaggregation
perform data aggregation in TanStack Table
Jul 26Data AnalysisFrontendTanStackapi-not-found
diagnose TanStack Table API errors
Jul 26DebuggingFrontendTanStackcell-selection
select rectangular cell ranges in tables
Jul 26Data AnalysisTanStackUI Componentsclient-vs-server
manage TanStack Table data pipelines
Jul 26Data PipelineFrontendPerformanceTanStackcolumn-faceting
build faceted filter UIs
Jul 26Data VisualizationFrontendTanStackcolumn-filtering
implement column filtering in TanStack Table
Jul 26Data AnalysisFrontendTanStack
More from TanStack
View publishercolumn-ordering
manage TanStack Table column ordering
table
Jul 26FrontendTanStackUI Componentscolumn-pinning
configure column pinning in TanStack Table
table
Jul 26CSSFrontendTanStackUI Componentscolumn-sizing
configure column sizing in TanStack Table
table
Jul 26CSSFrontendTanStackUI Componentscolumn-visibility
manage column visibility in TanStack Table
table
Jul 26FrontendTanStackUI Componentscore
build data grids with TanStack Table
table
Jul 26Data AnalysisFrontendUI Components