Skip to content

ColumnType

Column type - built-in primitives or custom type strings.

Use built-in types for automatic formatting, or define custom types (e.g., ‘currency’, ‘country’) with type-level defaults via typeDefaults.

type ColumnType = PrimitiveColumnType | string & object
// Built-in types
{ field: 'name', type: 'string' }
{ field: 'salary', type: 'number' }
// Custom types with defaults
grid.gridConfig = {
columns: [
{ field: 'salary', type: 'currency' },
{ field: 'birthCountry', type: 'country' },
],
typeDefaults: {
currency: {
format: (v) => `$${Number(v).toFixed(2)}`,
},
country: {
renderer: (ctx) => `🌍 ${ctx.value}`,
},
},
};
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