Skip to content

applyColumnDefaults

Apply column defaults to a list of columns. Individual column properties override defaults — the per-column value always wins over the default.

applyColumnDefaults(columns: ColumnConfig<TRow>[], defaults: Partial<ColumnConfig<TRow>> | undefined): ColumnConfig<TRow>[]
NameTypeDescription
columnsColumnConfig<TRow>[]Normalized columns to merge defaults into
defaultsPartial<ColumnConfig<TRow>> | undefinedPartial column config applied as a baseline; pass undefined to no-op

ColumnConfig<TRow>[] - A new array with the defaults merged in (input is not mutated)

applyColumnDefaults(
[{ field: 'id' }, { field: 'name', sortable: false }],
{ sortable: true, resizable: true },
);
// [
// { field: 'id', sortable: true, resizable: true },
// { field: 'name', sortable: false, resizable: true },
// ]
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt