Birch UI Grid overviewMIT
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.
Loading demo…
View source
Sample data and small UI helpers are imported from the docs' demos/_shared.ts and demos/_scheduler-data.ts files.
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.
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}`);
});<div id="orders" style="height: 420px"></div>createGrid() returns a GridApi. Use it to change data, read state, listen to events and tear the grid down:
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.
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'));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')}
/>
);
}<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>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');
}
}<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>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')}
/>
);
}<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>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, Updating data |
| Columns | Text, number, date and boolean types, flex sizing, value getters, setters, formatters and cell renderers |
Columns |
| Sorting | Single and multi-column sorting, type-aware comparison, custom comparators | Sorting |
| Filtering | Floating filters with an expression syntax, text, number, date, set and boolean filters, quick filter, custom predicates | Filtering |
| Editing | Text, number, select, checkbox and date editors, custom editors, value parsing | Editing |
| Selection | Single or multiple row selection, checkbox column | Selection |
| Column operations | Resize, reorder, pin, hide, autosize, persistable column state | Column operations |
| Pagination | Client-side pages with a page size | Pagination |
| Performance | Row and column virtualization, variable row heights, a million rows in the browser | Virtualization |
| Accessibility | WAI-ARIA grid pattern, roving tabindex, correct aria-rowcount while virtualized |
Accessibility |
| Theming | CSS custom properties, light, dark and auto themes, three densities | Theming |
| Export | CSV export as a string or a file download | CSV export |
| Extensibility | A module system with pipeline stages, cell decorators, key handlers and UI slots | Modules |
When you need Grid Pro#
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 to see what each module adds, or read Licensing for how keys work.
Next steps#
- Follow the Quick start for your framework.
- Read Columns to learn how values flow from rows to cells.
- Browse the API reference for every method on
GridApi.