Quick start
Build a sortable, filterable, editable orders grid in five minutes in React, Vue, Angular, Svelte, Solid, a Web Component or plain JavaScript.
This guide builds the same orders grid in every supported framework. Pick your framework once in any tab group below; the choice is remembered on every page.
The finished grid sorts on header click, filters from a row under the headers, edits customer and status cells inline, selects rows with checkboxes and pins the order number to the left:
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();
};
}1. Install#
npm install @birchui/core @birchui/reactnpm install @birchui/core @birchui/vuenpm install @birchui/core @birchui/angularnpm install @birchui/core @birchui/sveltenpm install @birchui/core @birchui/solidnpm install @birchui/core @birchui/elementnpm install @birchui/coreStyles are injected automatically when the grid is created. To import a CSS file instead, see Styles.
2. Describe your data#
Every example uses this module. Columns are plain objects: field reads a property of the row, header is the column title, and the other keys switch features on per column.
import type { ColumnDef } from '@birchui/core';
export interface Order {
id: string;
customer: string;
region: 'EMEA' | 'Americas' | 'APAC';
placedAt: string;
status: 'open' | 'shipped' | 'cancelled';
total: number;
}
const usd = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' });
export const columns: ColumnDef<Order>[] = [
{ field: 'id', header: 'Order', width: 120, pinned: 'left' },
{ field: 'customer', header: 'Customer', flex: 1, minWidth: 180, filter: 'text', editable: true },
{ field: 'region', header: 'Region', filter: 'set' },
{ field: 'placedAt', header: 'Placed', type: 'date', filter: 'date' },
{
field: 'status',
header: 'Status',
filter: 'set',
editable: true,
editor: 'select',
options: ['open', 'shipped', 'cancelled'],
},
{ field: 'total', header: 'Total', type: 'number', filter: 'number', format: (value) => usd.format(Number(value)) },
];
export const orders: Order[] = [
{ id: 'SO-10421', customer: 'Northwind Traders', region: 'EMEA', placedAt: '2026-11-02', status: 'open', total: 1840.5 },
{ id: 'SO-10422', customer: 'Contoso Ltd', region: 'Americas', placedAt: '2026-11-03', status: 'shipped', total: 312 },
{ id: 'SO-10423', customer: 'Fabrikam Inc', region: 'Americas', placedAt: '2026-11-03', status: 'cancelled', total: 96.4 },
{ id: 'SO-10424', customer: 'Tailspin Toys', region: 'APAC', placedAt: '2026-11-05', status: 'open', total: 2210 },
{ id: 'SO-10425', customer: 'Litware Inc', region: 'EMEA', placedAt: '2026-11-06', status: 'shipped', total: 764.25 },
{ id: 'SO-10426', customer: 'Adventure Works', region: 'APAC', placedAt: '2026-11-07', status: 'open', total: 5120 },
];
export const getRowId = (order: Order) => order.id;3. Render the grid#
import { useRef } from 'react';
import { BirchGrid } from '@birchui/react';
import type { GridApi } from '@birchui/core';
import { columns, getRowId, orders, type Order } from './orders';
export function OrdersGrid() {
const grid = useRef<GridApi<Order>>(null);
return (
<>
<button type="button" onClick={() => grid.current?.downloadCsv({ fileName: 'orders.csv' })}>
Export CSV
</button>
<BirchGrid<Order>
ref={grid}
style={{ height: 420 }}
columns={columns}
rows={orders}
getRowId={getRowId}
floatingFilters
rowSelection="multiple"
checkboxSelection
onCellValueChanged={({ row, colId, newValue }) => console.info(row.id, colId, newValue)}
/>
</>
);
}<script setup lang="ts">
import { ref } from 'vue';
import { BirchGrid } from '@birchui/vue';
import type { CellValueChangedEvent, GridApi } from '@birchui/core';
import { columns, getRowId, orders, type Order } from './orders';
const grid = ref<{ api: GridApi<Order> | null } | null>(null);
function onCellValueChanged({ row, colId, newValue }: CellValueChangedEvent<Order>) {
console.info(row.id, colId, newValue);
}
</script>
<template>
<button type="button" @click="grid?.api?.downloadCsv({ fileName: 'orders.csv' })">Export CSV</button>
<BirchGrid
ref="grid"
style="height: 420px"
:columns="columns"
:rows="orders"
:get-row-id="getRowId"
:floating-filters="true"
row-selection="multiple"
:checkbox-selection="true"
@cell-value-changed="onCellValueChanged"
/>
</template>import { ChangeDetectionStrategy, Component, viewChild } from '@angular/core';
import { BirchGridComponent } from '@birchui/angular';
import type { CellValueChangedEvent, GridOptions } from '@birchui/core';
import { columns, getRowId, orders, type Order } from './orders';
@Component({
selector: 'app-orders-grid',
standalone: true,
imports: [BirchGridComponent],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<button type="button" (click)="exportCsv()">Export CSV</button>
<birchui-grid
class="orders"
[columns]="columns"
[rows]="orders"
[options]="options"
(cellValueChanged)="logChange($event)"
/>
`,
styles: `.orders { height: 420px; }`,
})
export class OrdersGridComponent {
private readonly grid = viewChild.required<BirchGridComponent<Order>>(BirchGridComponent);
readonly columns = columns;
readonly orders = orders;
readonly options: Partial<GridOptions<Order>> = {
getRowId,
floatingFilters: true,
rowSelection: 'multiple',
checkboxSelection: true,
};
logChange({ row, colId, newValue }: CellValueChangedEvent<Order>): void {
console.info(row.id, colId, newValue);
}
exportCsv(): void {
this.grid().api?.downloadCsv({ fileName: 'orders.csv' });
}
}<script lang="ts">
import { birchGrid } from '@birchui/svelte';
import type { GridApi } from '@birchui/core';
import { columns, getRowId, orders, type Order } from './orders';
let api: GridApi<Order> | undefined;
</script>
<button type="button" onclick={() => api?.downloadCsv({ fileName: 'orders.csv' })}>Export CSV</button>
<div
class="orders"
use:birchGrid={{
columns,
rows: orders,
getRowId,
floatingFilters: true,
rowSelection: 'multiple',
checkboxSelection: true,
onReady: (grid) => (api = grid),
on: {
cellValueChanged: ({ row, colId, newValue }) => console.info(row.id, colId, newValue),
},
}}
></div>
<style>
.orders {
height: 420px;
}
</style>import { BirchGrid } from '@birchui/solid';
import type { GridApi } from '@birchui/core';
import { columns, getRowId, orders, type Order } from './orders';
export function OrdersGrid() {
let grid: GridApi<Order> | undefined;
return (
<>
<button type="button" onClick={() => grid?.downloadCsv({ fileName: 'orders.csv' })}>
Export CSV
</button>
<BirchGrid<Order>
ref={(api) => (grid = api)}
style={{ height: '420px' }}
columns={columns}
rows={orders}
getRowId={getRowId}
floatingFilters
rowSelection="multiple"
checkboxSelection
onCellValueChanged={({ row, colId, newValue }) => console.info(row.id, colId, newValue)}
/>
</>
);
}<style>
birchui-grid {
display: block;
height: 420px;
}
</style>
<button id="export" type="button">Export CSV</button>
<birchui-grid id="orders"></birchui-grid>
<script type="module">
import { defineBirchGrid } from '@birchui/element';
import { columns, getRowId, orders } from './orders.js';
defineBirchGrid();
const grid = document.querySelector('#orders');
grid.rows = orders;
grid.getRowId = getRowId;
grid.floatingFilters = true;
grid.rowSelection = 'multiple';
grid.checkboxSelection = true;
grid.columns = columns;
grid.addEventListener('cell-value-changed', (event) => {
const { row, colId, newValue } = event.detail;
console.info(row.id, colId, newValue);
});
document.querySelector('#export').addEventListener('click', () => {
grid.api?.downloadCsv({ fileName: 'orders.csv' });
});
</script>import { createGrid } from '@birchui/core';
import { columns, getRowId, orders, type Order } from './orders';
const container = document.querySelector<HTMLElement>('#orders')!;
container.style.height = '420px';
const grid = createGrid<Order>(container, {
columns,
rows: orders,
getRowId,
floatingFilters: true,
rowSelection: 'multiple',
checkboxSelection: true,
});
grid.on('cellValueChanged', ({ row, colId, newValue }) => console.info(row.id, colId, newValue));
document.querySelector('#export')?.addEventListener('click', () => {
grid.downloadCsv({ fileName: 'orders.csv' });
});4. Try it#
With the grid on screen:
- Sort: click a header. Shift-click another header to add a second sort column.
- Filter: type in the row under the headers. In the Total column, try
>1000or300..2000. - Edit: double-click a customer or status cell, or focus it and start typing. Press Enter to commit or Escape to cancel.
- Select: tick the checkboxes, or use the header checkbox to select every row.
- Navigate: click a cell, then move with the arrow keys. The full key map is in Keyboard navigation and accessibility.
- Resize and reorder: drag a header edge to resize, or drag a header to move the column.
5. Update the data#
Keep a reference to the grid API and change rows without rebuilding the grid:
grid.applyTransaction({
add: [{ id: 'SO-10427', customer: 'Proseware Inc', region: 'EMEA', placedAt: '2026-11-08', status: 'open', total: 1330 }],
update: [{ ...orders[0], status: 'shipped' }],
remove: ['SO-10423'],
});Rows are matched by the id from getRowId, so only the rows that changed are updated and selection stays with the same rows. See Updating data.