Column Width

Set each column's width to "auto", a fixed size, or "1fr". Optionally fill the container with autoExpandColumns.

Content-fit ("auto")

Use width: "auto" to size from the header and sampled cell content. Cap growth with maxWidth when you want truncation.

TypeScript
{
accessor: "email",
label: "Email",
width: "auto",
maxWidth: 300,
}

Fixed width

Pass a number for a pixel width. Best for IDs, dates, and other short columns.

TypeScript
{ accessor: "id", label: "ID", width: 60 }

Flexible width ("1fr")

Use width: "1fr" so the column shares leftover space with other flexible columns. Pair with minWidthso it doesn't get too narrow.

TypeScript
{
accessor: "name",
label: "Name",
width: "1fr",
minWidth: 120,
}

Fill the container

Set autoExpandColumns to scale all column widths proportionally so the table fills its container with no horizontal scroll. Prefer falseon small screens (< 768px).

React TSX
<SimpleTable columns={columns} rows={rows} height="400px" autoExpandColumns={true} />

Example

Fixed, flexible, and auto columns together. On wider viewports the demo enables autoExpandColumns.

How "1fr" splits space

Fixed columns take their pixels first. Remaining width is split equally among 1fr columns. In a 1000px table with fixed 100px + 150px and two 1fr columns, each flexible column gets 375px.

autoExpandColumns trade-offs

Column width values are the scale base. minWidth /maxWidth are not enforced while scaling.

Props

Column Width Properties

PropertyRequiredDescriptionExample
Required
Column width: a pixel number, '1fr' to share leftover space, or 'auto' to fit content (clamped by minWidth/maxWidth).
ColumnDef.minWidth
number
Optional
Minimum width for '1fr' and 'auto' columns. Not enforced during autoExpandColumns scaling.
ColumnDef.maxWidth
number
Optional
Maximum width. With width: 'auto', content past the cap truncates. Ignored when autoExpandColumns is enabled.
autoExpandColumns
Optional
Scale all column widths proportionally to fill the container. Recommended off on mobile (< 768px).