Skip to content

createGrid

Create a new typed grid element programmatically.

This avoids the need to cast when creating grids in TypeScript:

// Before: manual cast required
const grid = document.createElement('tbw-grid') as DataGridElement<Employee>;
// After: fully typed
const grid = createGrid<Employee>({
columns: [{ field: 'name' }],
plugins: [new SelectionPlugin()],
});
grid.rows = employees; // ✓ Typed!
function createGrid(config: Partial<GridConfig<TRow>>): DataGridElement<TRow>
NameTypeDescription
configPartial<GridConfig<TRow>>Optional initial grid configuration
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