# createGrid

> _Since v0.6.0_

Create a new typed grid element programmatically.

This avoids the need to cast when creating grids in TypeScript:
```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!
```

```ts
function createGrid(config: Partial<GridConfig<TRow>>): DataGridElement<TRow>
```

## Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| `config` | <code>Partial&lt;<a href="/grid/api/core/interfaces/gridconfig/">GridConfig</a>&lt;TRow&gt;&gt;</code> | Optional initial grid configuration |
