useTableColumnResize@astryxdesign/core v0.5.2 · useTableColumnResize

Usage

Hook that returns a TablePlugin adding draggable resize handles to column header borders. Supports pointer + keyboard (WAI-ARIA window splitter) resizing, RTL, per-column min/max widths, and proportional-column preservation (resizes the neighbor so the table stays full-width). Commits widths on release.

ts
import {useTableColumnResize} from '@astryxdesign/core/Table'

Parameters

ParamTypeDescription
columnWidths
Record<string, number>

Controlled pixel-width overrides keyed by column key. When a key is present it overrides the column's declared width.

onColumnResizeEnd
(updates: Record<string, number>) => void

Called when a resize completes (pointerup / Enter). Receives a map of every column key whose width changed; merge it into your columnWidths state.

minWidth
number

Global minimum column width in pixels during resize. Overrides per-column defaults when set.

maxWidth
number (default: Infinity)

Global maximum column width in pixels during resize.

columns
<T>[]

Column definitions, needed to derive per-column min widths and detect proportional vs pixel columns for neighbor/last-column resize behavior.

Examples

Common configurations, variations, and states.
useTableColumnResize — Draggable Columns
Open in Playground

A Table using useTableColumnResize. Drag the right edge of any column header to resize; widths are committed on release. The last proportional column flexes to fill remaining space.