Examples › Column resizing
Mantine DataTable lets users resize columns by dragging a handle at the edge of a column header. Resized widths can optionally be persisted in the browser’s local storage, so they survive page reloads.
In order to enable column resizing with persistent widths, you’ll have to:
- add a
resizable: trueproperty to each resizing candidate column; - add a
storeColumnsKey: 'your_key'property to the DataTable (the column widths are persisted in local storage under this key); - use the
useDataTableColumns()hook with the samekeyto get the effective columns and theresetColumnsWidth()function.
Here’s how resizing works:
- dragging a handle changes the width of the column and of the column next to it, so the overall table width stays the same;
- a column can’t be made narrower than 50 pixels;
- the last column has no resize handle, since there’s no column after it;
- double-clicking a handle resets the two adjacent columns to their default widths;
- calling
resetColumnsWidth()restores all columns to thewidththey were defined with in thecolumnsprop (or to automatic width, if they don’t have one).
Resizing without persistence
If you don’t need to remember the column widths, simply add resizable: true to the columns you want to make resizable — no storeColumnsKey or useDataTableColumns() hook required. The widths will be reset to their defaults when the component is remounted:
Combining resizing with other column features
Resizing can be combined with sorting, records selection, as well as column dragging and toggling. Widths, order and visibility are persisted under the same storeColumnsKey, and each can be reset independently. Notice how the example below avoids repetition by spreading a shared object into each column definition:
Head over to the next example to discover more features.












