# Birch UI Grid overview

> A fast, accessible, framework-agnostic data grid with sorting, filtering, editing, virtualization and CSV export, free under the MIT license.

Birch UI Grid is the free, MIT-licensed data grid in `@birchui/core`. It is written in vanilla TypeScript, renders straight to the DOM without a framework runtime, and is the engine that every other Birch UI product builds on. The same `createGrid()` call powers the React, Vue, Angular, Svelte and Solid components and the `<birchui-grid>` custom element.

**Live demo: Orders grid** (runs on the HTML version of this page). Source of `demos/basic-grid.ts`. Imports from `./_shared` and `./_scheduler-data` are sample data and small UI helpers used only by the docs.

```ts
import { createGrid, type ColumnDef } from '@birchui/core';
import { docsTheme, formatCurrency, makeOrders, onDocsThemeChange, revenueOf, type Order } from './_shared';

export const meta = { title: 'Orders grid', height: 420 };

const columns: ColumnDef<Order>[] = [
  { field: 'id', header: 'Order', width: 110 },
  { field: 'customer', header: 'Customer', flex: 1, minWidth: 180 },
  { field: 'region', header: 'Region', width: 140 },
  { field: 'product', header: 'Product', width: 190 },
  { field: 'quantity', header: 'Qty', type: 'number', width: 80 },
  { id: 'revenue', header: 'Revenue', type: 'number', width: 120, valueGetter: revenueOf, format: formatCurrency },
  { field: 'orderDate', header: 'Ordered', type: 'date', width: 120 },
];

export default function mount(el: HTMLElement): () => void {
  const grid = createGrid<Order>(el, {
    columns,
    rows: makeOrders(500),
    getRowId: (order) => order.id,
    theme: docsTheme(),
    ariaLabel: 'Customer orders',
  });
  const stopTheme = onDocsThemeChange((theme) => grid.update({ theme }));
  return () => {
    stopTheme();
    grid.destroy();
  };
}
```

## A first grid

Give the grid a container with a height, a list of columns and an array of rows. Everything else is optional.

```ts title="orders-grid.ts"
import { createGrid, type ColumnDef } from '@birchui/core';

interface Order {
  id: string;
  customer: string;
  region: 'EMEA' | 'North America' | 'APAC' | 'LATAM';
  orderDate: string;
  quantity: number;
  revenue: number;
  status: 'Pending' | 'Shipped' | 'Backordered' | 'Cancelled';
}

const orders: Order[] = [
  { id: 'SO-10421', customer: 'Northwind Traders', region: 'EMEA', orderDate: '2026-03-02', quantity: 40, revenue: 18400, status: 'Shipped' },
  { id: 'SO-10422', customer: 'Blue Harbor Foods', region: 'North America', orderDate: '2026-03-03', quantity: 12, revenue: 5520, status: 'Pending' },
  { id: 'SO-10423', customer: 'Kestrel Logistics', region: 'APAC', orderDate: '2026-03-03', quantity: 75, revenue: 33750, status: 'Backordered' },
  { id: 'SO-10424', customer: 'Alvarez & Hijos', region: 'LATAM', orderDate: '2026-03-05', quantity: 8, revenue: 3680, status: 'Shipped' },
];

const columns: ColumnDef<Order>[] = [
  { field: 'id', header: 'Order', width: 120, pinned: 'left' },
  { field: 'customer', flex: 1, minWidth: 180 },
  { field: 'region', filter: true },
  { field: 'orderDate', header: 'Ordered', type: 'date', filter: true },
  { field: 'quantity', header: 'Qty', type: 'number', width: 90 },
  {
    field: 'revenue',
    type: 'number',
    format: (value) => new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(Number(value)),
  },
  { field: 'status', options: ['Pending', 'Shipped', 'Backordered', 'Cancelled'], editable: true, filter: true },
];

const grid = createGrid<Order>(document.querySelector('#orders')!, {
  columns,
  rows: orders,
  getRowId: (order) => order.id,
  floatingFilters: true,
  rowSelection: 'multiple',
  checkboxSelection: true,
  ariaLabel: 'Sales orders',
});

grid.on('cellValueChanged', ({ row, colId, oldValue, newValue }) => {
  console.info(`${row.id}: ${colId} changed from ${oldValue} to ${newValue}`);
});
```

```html title="index.html"
<div id="orders" style="height: 420px"></div>
```

`createGrid()` returns a [`GridApi`](https://docs.birchui.com/api/core.md#gridapi). Use it to change data, read state, listen to events and tear the grid down:

```ts
grid.update({ quickFilter: 'northwind' });
grid.applyTransaction({ update: [{ ...orders[1], status: 'Shipped' }] });
const selected = grid.getSelectedRows();
grid.destroy();
```

## The same grid in your framework

Every adapter is a thin wrapper around `createGrid()`, so options, events and the API are identical. The framework pages cover typing, refs and server rendering in depth.

**JavaScript**

```ts
import { createGrid } from '@birchui/core';

const grid = createGrid(document.querySelector('#orders')!, { columns, rows: orders, rowSelection: 'multiple' });
grid.on('selectionChanged', ({ selected }) => console.info(selected.length, 'orders selected'));
```

**React**

```tsx
import { BirchGrid } from '@birchui/react';

export function OrdersGrid({ orders }: { orders: Order[] }) {
  return (
    <BirchGrid<Order>
      style={{ height: 420 }}
      columns={columns}
      rows={orders}
      rowSelection="multiple"
      onSelectionChanged={({ selected }) => console.info(selected.length, 'orders selected')}
    />
  );
}
```

**Vue**

```vue
<script setup lang="ts">
import { BirchGrid } from '@birchui/vue';
defineProps<{ orders: Order[] }>();
</script>

<template>
  <BirchGrid
    style="height: 420px"
    :columns="columns"
    :rows="orders"
    row-selection="multiple"
    @selection-changed="({ selected }) => console.info(selected.length, 'orders selected')"
  />
</template>
```

**Angular**

```ts
import { Component, input } from '@angular/core';
import { BirchGridComponent } from '@birchui/angular';

@Component({
  selector: 'app-orders-grid',
  standalone: true,
  imports: [BirchGridComponent],
  template: `<birchui-grid style="height: 420px" [columns]="columns" [rows]="orders()" [options]="{ rowSelection: 'multiple' }" (selectionChanged)="onSelection($event)" />`,
})
export class OrdersGridComponent {
  orders = input.required<Order[]>();
  columns = columns;
  onSelection(event: { selected: Order[] }) {
    console.info(event.selected.length, 'orders selected');
  }
}
```

**Svelte**

```svelte
<script lang="ts">
  import { BirchGrid } from '@birchui/svelte';
  let { orders }: { orders: Order[] } = $props();
</script>

<div style="height: 420px">
  <BirchGrid {columns} rows={orders} rowSelection="multiple" onSelectionChanged={({ selected }) => console.info(selected.length, 'orders selected')} />
</div>
```

**Solid**

```tsx
import { BirchGrid } from '@birchui/solid';

export function OrdersGrid(props: { orders: Order[] }) {
  return (
    <BirchGrid<Order>
      style={{ height: '420px' }}
      columns={columns}
      rows={props.orders}
      rowSelection="multiple"
      onSelectionChanged={({ selected }) => console.info(selected.length, 'orders selected')}
    />
  );
}
```

**Web Component**

```html
<birchui-grid id="orders" theme="auto" style="display: block; height: 420px"></birchui-grid>
<script type="module">
  import { defineBirchGrid } from '@birchui/element';

  defineBirchGrid();
  const grid = document.querySelector('#orders');
  grid.getRowId = (order) => order.id;
  grid.rowSelection = 'multiple';
  grid.columns = columns;
  grid.rows = orders;
  grid.addEventListener('selection-changed', (event) => console.info(event.detail.selected.length, 'orders selected'));
</script>
```

> **Note**
>
> Event names follow each framework's conventions: `onSelectionChanged` props in React, Svelte and Solid, `@selection-changed` in Vue, `(selectionChanged)` outputs in Angular and `selection-changed` DOM events, with the payload in `event.detail`, on `<birchui-grid>`. See [React](https://docs.birchui.com/frameworks/react.md), [Vue](https://docs.birchui.com/frameworks/vue.md), [Angular](https://docs.birchui.com/frameworks/angular.md), [Svelte](https://docs.birchui.com/frameworks/svelte.md), [Solid](https://docs.birchui.com/frameworks/solid.md) and [Web Component](https://docs.birchui.com/frameworks/web-component.md) for the exact bindings.

## What is included

Everything below ships in `@birchui/core` under the MIT license, with no license key and no watermark.

| Area | Features | Guide |
| --- | --- | --- |
| Data | Plain arrays of objects, stable row IDs, transactions for add, update and remove | [Rows](https://docs.birchui.com/grid/rows.md), [Updating data](https://docs.birchui.com/grid/updating-data.md) |
| Columns | Text, number, date and boolean types, `flex` sizing, value getters, setters, formatters and cell renderers | [Columns](https://docs.birchui.com/grid/columns.md) |
| Sorting | Single and multi-column sorting, type-aware comparison, custom comparators | [Sorting](https://docs.birchui.com/grid/sorting.md) |
| Filtering | Floating filters with an expression syntax, text, number, date, set and boolean filters, quick filter, custom predicates | [Filtering](https://docs.birchui.com/grid/filtering.md) |
| Editing | Text, number, select, checkbox and date editors, custom editors, value parsing | [Editing](https://docs.birchui.com/grid/editing.md) |
| Selection | Single or multiple row selection, checkbox column | [Selection](https://docs.birchui.com/grid/selection.md) |
| Column operations | Resize, reorder, pin, hide, autosize, persistable column state | [Column operations](https://docs.birchui.com/grid/column-operations.md) |
| Pagination | Client-side pages with a page size | [Pagination](https://docs.birchui.com/grid/pagination.md) |
| Performance | Row and column virtualization, variable row heights, a million rows in the browser | [Virtualization](https://docs.birchui.com/grid/virtualization.md) |
| Accessibility | WAI-ARIA grid pattern, roving tabindex, correct `aria-rowcount` while virtualized | [Accessibility](https://docs.birchui.com/grid/accessibility.md) |
| Theming | CSS custom properties, light, dark and auto themes, three densities | [Theming](https://docs.birchui.com/grid/theming.md) |
| Export | CSV export as a string or a file download | [CSV export](https://docs.birchui.com/grid/csv-export.md) |
| Extensibility | A module system with pipeline stages, cell decorators, key handlers and UI slots | [Modules](https://docs.birchui.com/grid/modules.md) |

## When you need Grid Pro

> **Grid Pro: Paid feature. Fully functional without a key; a license removes the watermark. Pricing: https://docs.birchui.com/getting-started/pricing.md**
>
> Row grouping, aggregation, tree data, pivoting, range selection, clipboard copy and paste, the fill handle, master/detail rows, the status bar and styled Excel import and export live in `@birchui/grid-pro`. They plug into the same grid through the `modules` option, so upgrading never means rewriting your columns or event handlers.

```ts
import { createGrid } from '@birchui/core';
import { RowGroupingModule, AggregationModule } from '@birchui/grid-pro';

createGrid(container, {
  columns,
  rows: orders,
  modules: [RowGroupingModule, AggregationModule],
  groupBy: ['region'],
});
```

Start with the [Grid Pro overview](https://docs.birchui.com/grid-pro/overview.md) to see what each module adds, or read [Licensing](https://docs.birchui.com/getting-started/licensing.md) for how keys work.

## Next steps

- Follow the [Quick start](https://docs.birchui.com/getting-started/quick-start.md) for your framework.
- Read [Columns](https://docs.birchui.com/grid/columns.md) to learn how values flow from rows to cells.
- Browse the [API reference](https://docs.birchui.com/grid/api-reference.md) for every method on `GridApi`.
