Skip to content

maxWidth

A ceiling over the column’s width.

Typenumber
Defaultnot set
Live update (update())Yes — give the columns again (update({ columns }))
Declared inpackages/core/src/columns/defs.ts

No width goes over it: the definition’s, the user’s drag, the menu’s « Widen », a fit to the content, a flex share. The room a capped flexible column cannot take goes to the other flexible columns. Without it, there is no ceiling. When it is under minWidth, minWidth wins.

A value that is not a number of zero or more is refused with an invalid-column error.

import { createGrid } from '@dzgrid/dom';
import { EN } from '@dzgrid/dom/locales/en';
type Tool = { id: string; name: string; shelf: number; notes: string };
createGrid<Tool>(document.getElementById('tools')!, {
rows: [{ id: 't1', name: 'Hammer', shelf: 2, notes: 'Claw, 450 g' }],
columns: [
{ id: 'name', header: 'Tool', flex: 1, maxWidth: 220 },
{ id: 'notes', header: 'Notes', flex: 1 },
],
getRowId: (r) => r.id,
messages: EN,
});