Data grid
An interactive grid for large record sets, driven by column definitions, with keyboard navigation between cells, sorting, filtering, search, selection, cell editing, grouping, trees and virtualized rows.
import type { GridColumn } from '@slotted/core/grid';import { Badge } from '@slotted/react/badge';import { DataGrid } from '@slotted/react/data-grid';interface Order { id: string; customer: string; warehouse: string; status: string; placed: string; total: number;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const WAREHOUSES = ['Reno', 'Columbus', 'Savannah'];const STATUSES = ['Processing', 'Shipped', 'On hold', 'Delivered'];const ORDERS: Order[] = Array.from({ length: 24 }, (_, index) => ({ id: `SO-${10421 + index}`, customer: CUSTOMERS[(index * 5) % CUSTOMERS.length]!, warehouse: WAREHOUSES[index % WAREHOUSES.length]!, status: STATUSES[(index * 3) % STATUSES.length]!, placed: `2026-09-${String(1 + (index % 28)).padStart(2, '0')}`, total: 140 + ((index * 733) % 4100),}));const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const TONE: Record<string, 'accent' | 'secondary' | 'success' | 'warning'> = { Delivered: 'success', 'On hold': 'warning', Processing: 'accent', Shipped: 'secondary',};const columns: GridColumn<Order>[] = [ { id: 'id', label: 'Order', accessor: 'id', rowHeader: true, width: 120, sortable: true }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180, sortable: true, }, { id: 'warehouse', label: 'Warehouse', accessor: 'warehouse', width: 130, sortable: true }, { id: 'status', label: 'Status', accessor: 'status', width: 130, sortable: true }, { id: 'placed', label: 'Placed', accessor: 'placed', kind: 'date', width: 130, sortable: true }, { id: 'total', label: 'Total', accessor: 'total', numeric: true, width: 130, sortable: true, format: (value) => USD.format(value as number), },];export default function DataGridBasic() { return ( <DataGrid aria-label="Orders" cellRenderers={{ status: ({ value }) => ( <Badge tone={TONE[String(value)]} variant="soft"> {String(value)} </Badge> ), }} columns={columns} height="24rem" rowKey="id" rows={ORDERS} selectionMode="multiple" /> );}Installation
The packages are a 0.x beta on npm, and their public API changes between beta releases without deprecation. One line installs the binding and the default theme.
pnpm add @slotted/react @slotted/theme @slotted/themesimport { DataGrid, DataGridDefaultsProvider, type DataGridColumn } from '@slotted/react';import type { GridColumn, GridQuery, GridColumnState } from '@slotted/core/grid';import { applyQuery, emptyQuery, toGridParams, fromGridParams } from '@slotted/core/grid';Data grid or table
A data grid is one composite widget: Tab enters it on one cell, and the arrow keys move between cells, rows and the header. It applies the sort, the filter and the search itself, and it mounts only the rows in view. Use it for working sets a reader navigates, edits or selects in. Use the table when the content is a document: a report, a short listing, a summary inside a page, where each control is its own Tab stop.
Columns
columns is a list of GridColumn definitions from @slotted/core/grid, the same object in React and Angular. accessor reads the value from the row, format turns it into the text a cell shows, and kind (text, number, date, datetime, boolean, set) decides how the column sorts, filters and edits. width fixes a column, flex shares the space left over, and rowHeader marks the column that names each row.
import type { GridColumn } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const DESTINATIONS = [ 'Berlin, DE', 'Marseille, FR', 'Graz, AT', 'Bräcke, SE', 'Rio de Janeiro, BR', 'Cowes, UK', 'Boise, US', 'Oulu, FI',];const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];function shipments(count: number): Shipment[] { let seed = 7; const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296; const pick = <T,>(list: readonly T[]) => list[Math.floor(next() * list.length)]!; return Array.from({ length: count }, (_, index) => { const weight = Math.round(next() * 9000) / 10; return { id: `SH-${3301 + index}`, customer: pick(CUSTOMERS), destination: pick(DESTINATIONS), carrier: pick(CARRIERS), status: pick(STATUSES), shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`, weight, cost: Math.round(weight * (2 + next() * 3) * 100) / 100, priority: next() < 0.3, }; });}const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const ROWS = shipments(8);export default function DataGridColumns() { return ( <DataGrid aria-label="Shipments" columns={COLUMNS} rowKey="id" rows={ROWS} height="22rem" /> );}Column groups
columnGroups draws a header row above the column headers, with one cell spanning each group of columns. A group names its columns by id.
import type { GridColumn, GridColumnGroup } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const DESTINATIONS = [ 'Berlin, DE', 'Marseille, FR', 'Graz, AT', 'Bräcke, SE', 'Rio de Janeiro, BR', 'Cowes, UK', 'Boise, US', 'Oulu, FI',];const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];function shipments(count: number): Shipment[] { let seed = 7; const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296; const pick = <T,>(list: readonly T[]) => list[Math.floor(next() * list.length)]!; return Array.from({ length: count }, (_, index) => { const weight = Math.round(next() * 9000) / 10; return { id: `SH-${3301 + index}`, customer: pick(CUSTOMERS), destination: pick(DESTINATIONS), carrier: pick(CARRIERS), status: pick(STATUSES), shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`, weight, cost: Math.round(weight * (2 + next() * 3) * 100) / 100, priority: next() < 0.3, }; });}const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const GROUPS: GridColumnGroup[] = [ { id: 'shipment', label: 'Shipment', columns: ['id', 'customer', 'destination'] }, { id: 'transport', label: 'Transport', columns: ['carrier', 'status', 'shipped'] }, { id: 'charges', label: 'Charges', columns: ['weight', 'cost'] },];const ROWS = shipments(8);export default function DataGridColumnGroups() { return ( <DataGrid aria-label="Shipments" columns={COLUMNS} rowKey="id" rows={ROWS} columnGroups={GROUPS} height="22rem" /> );}Sorting
Press a header to sort by that column; press again to reverse it and a third time to clear it. Shift+Enter on a header adds the column to the sort order instead of replacing it. The sort is part of the query: query with onQueryChange ([(query)] in Angular) holds sort, filter, search, grouping and paging as one object.
import { useState } from 'react';import { emptyQuery, type GridColumn, type GridQuery } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';import { Stack } from '@slotted/react/stack';import { Text } from '@slotted/react/typography';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const DESTINATIONS = [ 'Berlin, DE', 'Marseille, FR', 'Graz, AT', 'Bräcke, SE', 'Rio de Janeiro, BR', 'Cowes, UK', 'Boise, US', 'Oulu, FI',];const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];function shipments(count: number): Shipment[] { let seed = 7; const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296; const pick = <T,>(list: readonly T[]) => list[Math.floor(next() * list.length)]!; return Array.from({ length: count }, (_, index) => { const weight = Math.round(next() * 9000) / 10; return { id: `SH-${3301 + index}`, customer: pick(CUSTOMERS), destination: pick(DESTINATIONS), carrier: pick(CARRIERS), status: pick(STATUSES), shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`, weight, cost: Math.round(weight * (2 + next() * 3) * 100) / 100, priority: next() < 0.3, }; });}const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const ROWS = shipments(12);export default function DataGridSorting() { const [query, setQuery] = useState<GridQuery>({ ...emptyQuery(), sort: [ { column: 'carrier', direction: 'ascending' }, { column: 'cost', direction: 'descending' }, ], }); const order = query.sort.map((key) => `${key.column} ${key.direction}`).join(', ') || 'none'; return ( <Stack gap={3}> <Text size="sm" tone="muted"> Sorted by: {order} </Text> <DataGrid aria-label="Shipments" columns={COLUMNS} rowKey="id" rows={ROWS} height="22rem" onQueryChange={setQuery} query={query} /> </Stack> );}Filter row
filterRow adds a row of operands under the headers, one per column, with the control its kind calls for: a text field, a number field, a date picker, a yes-or-no select or a multi-select of the column’s options. withColumnFilter from @slotted/core/grid builds a query with a filter already applied.
import { emptyQuery, withColumnFilter, type GridColumn } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const DESTINATIONS = [ 'Berlin, DE', 'Marseille, FR', 'Graz, AT', 'Bräcke, SE', 'Rio de Janeiro, BR', 'Cowes, UK', 'Boise, US', 'Oulu, FI',];const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];function shipments(count: number): Shipment[] { let seed = 7; const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296; const pick = <T,>(list: readonly T[]) => list[Math.floor(next() * list.length)]!; return Array.from({ length: count }, (_, index) => { const weight = Math.round(next() * 9000) / 10; return { id: `SH-${3301 + index}`, customer: pick(CUSTOMERS), destination: pick(DESTINATIONS), carrier: pick(CARRIERS), status: pick(STATUSES), shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`, weight, cost: Math.round(weight * (2 + next() * 3) * 100) / 100, priority: next() < 0.3, }; });}const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const INITIAL_QUERY = withColumnFilter(emptyQuery(), 'status', { kind: 'set', join: 'and', conditions: [{ operator: 'anyOf', value: ['Delayed', 'Customs'] }],}).query;const ROWS = shipments(24);export default function DataGridFilterRow() { return ( <DataGrid aria-label="Shipments" columns={COLUMNS} rowKey="id" rows={ROWS} defaultQuery={INITIAL_QUERY} filterRow height="24rem" /> );}Search
The query’s search matches every column marked searchable, which is every column by default in client mode. Put the search field outside the grid and write its text into the query with withSearch.
import { useState } from 'react';import { emptyQuery, withSearch, type GridColumn, type GridQuery } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';import { Stack } from '@slotted/react/stack';import { TextField } from '@slotted/react/text-field';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const DESTINATIONS = [ 'Berlin, DE', 'Marseille, FR', 'Graz, AT', 'Bräcke, SE', 'Rio de Janeiro, BR', 'Cowes, UK', 'Boise, US', 'Oulu, FI',];const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];function shipments(count: number): Shipment[] { let seed = 7; const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296; const pick = <T,>(list: readonly T[]) => list[Math.floor(next() * list.length)]!; return Array.from({ length: count }, (_, index) => { const weight = Math.round(next() * 9000) / 10; return { id: `SH-${3301 + index}`, customer: pick(CUSTOMERS), destination: pick(DESTINATIONS), carrier: pick(CARRIERS), status: pick(STATUSES), shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`, weight, cost: Math.round(weight * (2 + next() * 3) * 100) / 100, priority: next() < 0.3, }; });}const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const ROWS = shipments(24);export default function DataGridSearch() { const [query, setQuery] = useState<GridQuery>({ ...emptyQuery(), search: 'graz' }); return ( <Stack gap={3}> <TextField aria-label="Search shipments" clearable onValueChange={(text) => setQuery((current) => withSearch(current, text).query)} placeholder="Search shipments" value={query.search} /> <DataGrid aria-label="Shipments" columns={COLUMNS} rowKey="id" rows={ROWS} height="22rem" onQueryChange={setQuery} query={query} /> </Stack> );}Selecting rows
selectionMode="multiple" draws a checkbox column. Shift+Space toggles the current row, Shift extends from the anchor row, and Ctrl+A selects every row the query left. Keys in disabledKeys cannot be selected, and their rows take the disabled ink. isRowSelectable keeps a row out of the selection and leaves the rest of it as it is: it is read, opened and edited like its neighbours. isRowMuted draws a row that is no longer active in the muted ink and keeps it selectable. value with onValueChange ([(value)] in Angular) holds the selected row keys. footer (slDataGridFooter in Angular) adds a bar under the grid.
import { useState } from 'react';import type { GridColumn } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';import { Text } from '@slotted/react/typography';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const DESTINATIONS = [ 'Berlin, DE', 'Marseille, FR', 'Graz, AT', 'Bräcke, SE', 'Rio de Janeiro, BR', 'Cowes, UK', 'Boise, US', 'Oulu, FI',];const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];function shipments(count: number): Shipment[] { let seed = 7; const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296; const pick = <T,>(list: readonly T[]) => list[Math.floor(next() * list.length)]!; return Array.from({ length: count }, (_, index) => { const weight = Math.round(next() * 9000) / 10; return { id: `SH-${3301 + index}`, customer: pick(CUSTOMERS), destination: pick(DESTINATIONS), carrier: pick(CARRIERS), status: pick(STATUSES), shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`, weight, cost: Math.round(weight * (2 + next() * 3) * 100) / 100, priority: next() < 0.3, }; });}const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const ROWS = shipments(12);const DISABLED = ['SH-3305'];export default function DataGridSelection() { const [value, setValue] = useState<string | readonly string[] | null>(['SH-3302', 'SH-3303']); const count = Array.isArray(value) ? value.length : value === null ? 0 : 1; return ( <DataGrid aria-label="Shipments" columns={COLUMNS} rowKey="id" rows={ROWS} disabledKeys={DISABLED} footer={ <Text size="sm" tone="muted"> {count} selected </Text> } height="24rem" onValueChange={setValue} selectionMode="multiple" value={value} /> );}Selecting a range
selectionMode="range" selects a rectangle of cells, the way a spreadsheet does: Shift and the arrow keys extend it from the anchor, a pointer drag sets it, and Ctrl+C copies it as tab-separated text that pastes into a spreadsheet.
import type { GridColumn } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const DESTINATIONS = [ 'Berlin, DE', 'Marseille, FR', 'Graz, AT', 'Bräcke, SE', 'Rio de Janeiro, BR', 'Cowes, UK', 'Boise, US', 'Oulu, FI',];const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];function shipments(count: number): Shipment[] { let seed = 7; const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296; const pick = <T,>(list: readonly T[]) => list[Math.floor(next() * list.length)]!; return Array.from({ length: count }, (_, index) => { const weight = Math.round(next() * 9000) / 10; return { id: `SH-${3301 + index}`, customer: pick(CUSTOMERS), destination: pick(DESTINATIONS), carrier: pick(CARRIERS), status: pick(STATUSES), shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`, weight, cost: Math.round(weight * (2 + next() * 3) * 100) / 100, priority: next() < 0.3, }; });}const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const ROWS = shipments(12);export default function DataGridRange() { return ( <DataGrid aria-label="Shipments" columns={COLUMNS} rowKey="id" rows={ROWS} defaultCurrent={{ row: 'SH-3303', column: 'weight' }} height="24rem" selectionMode="range" /> );}Editing cells
A column with editable: true opens an editor on Enter, F2, a double press, or a typed character. Enter commits and moves one row down, Tab commits and moves to the next editable cell, Escape cancels. validate returns the message shown while a draft is invalid. The grid does not change your rows: onEditCommit ((editCommit) in Angular) reports the row key and the changed values, and you write them back.
import { useState } from 'react';import type { GridColumn } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const DESTINATIONS = [ 'Berlin, DE', 'Marseille, FR', 'Graz, AT', 'Bräcke, SE', 'Rio de Janeiro, BR', 'Cowes, UK', 'Boise, US', 'Oulu, FI',];const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];function shipments(count: number): Shipment[] { let seed = 7; const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296; const pick = <T,>(list: readonly T[]) => list[Math.floor(next() * list.length)]!; return Array.from({ length: count }, (_, index) => { const weight = Math.round(next() * 9000) / 10; return { id: `SH-${3301 + index}`, customer: pick(CUSTOMERS), destination: pick(DESTINATIONS), carrier: pick(CARRIERS), status: pick(STATUSES), shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`, weight, cost: Math.round(weight * (2 + next() * 3) * 100) / 100, priority: next() < 0.3, }; });}const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const EDIT_COLUMNS: GridColumn<Shipment>[] = COLUMNS.map((column) => column.id === 'weight' ? { ...column, editable: true, validate: (value: unknown) => typeof value === 'number' && value <= 0 ? 'Enter a weight above zero.' : null, } : ['customer', 'destination', 'carrier'].includes(column.id) ? { ...column, editable: true } : column,);const ROWS = shipments(8);export default function DataGridEditing() { const [rows, setRows] = useState(ROWS); return ( <DataGrid aria-label="Shipments" columns={EDIT_COLUMNS} rowKey="id" rows={rows} editMode="cell" height="22rem" onEditCommit={({ key, changes }) => setRows((current) => current.map((row) => (row.id === key ? { ...row, ...changes } : row))) } /> );}Editing rows
editMode="row" opens every editable cell of the row at once, with Save and Cancel in an actions column. Tab moves between the row’s editors, Enter commits the row and Escape cancels it, for records whose fields are checked as a whole.
import { useState } from 'react';import type { GridColumn } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const DESTINATIONS = [ 'Berlin, DE', 'Marseille, FR', 'Graz, AT', 'Bräcke, SE', 'Rio de Janeiro, BR', 'Cowes, UK', 'Boise, US', 'Oulu, FI',];const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];function shipments(count: number): Shipment[] { let seed = 7; const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296; const pick = <T,>(list: readonly T[]) => list[Math.floor(next() * list.length)]!; return Array.from({ length: count }, (_, index) => { const weight = Math.round(next() * 9000) / 10; return { id: `SH-${3301 + index}`, customer: pick(CUSTOMERS), destination: pick(DESTINATIONS), carrier: pick(CARRIERS), status: pick(STATUSES), shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`, weight, cost: Math.round(weight * (2 + next() * 3) * 100) / 100, priority: next() < 0.3, }; });}const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const EDIT_COLUMNS: GridColumn<Shipment>[] = COLUMNS.map((column) => column.id === 'weight' ? { ...column, editable: true, validate: (value: unknown) => typeof value === 'number' && value <= 0 ? 'Enter a weight above zero.' : null, } : ['customer', 'destination', 'carrier'].includes(column.id) ? { ...column, editable: true } : column,);const ROWS = shipments(8);export default function DataGridEditingRow() { const [rows, setRows] = useState(ROWS); return ( <DataGrid aria-label="Shipments" columns={EDIT_COLUMNS} rowKey="id" rows={rows} editMode="row" height="22rem" onEditCommit={({ key, changes }) => setRows((current) => current.map((row) => (row.id === key ? { ...row, ...changes } : row))) } /> );}Pinning, resizing and reordering
defaultColumnState sets where columns start: pinned.start and pinned.end keep columns in view while the others scroll, and widths sets starting widths. Columns resize by dragging the edge of the header, or with Ctrl+Shift+ArrowLeft and Ctrl+Shift+ArrowRight on a header, and reorder by dragging the header, or with Alt+ArrowLeft and Alt+ArrowRight. columnState with onColumnStateChange holds the result.
import type { GridColumn } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const DESTINATIONS = [ 'Berlin, DE', 'Marseille, FR', 'Graz, AT', 'Bräcke, SE', 'Rio de Janeiro, BR', 'Cowes, UK', 'Boise, US', 'Oulu, FI',];const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];function shipments(count: number): Shipment[] { let seed = 7; const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296; const pick = <T,>(list: readonly T[]) => list[Math.floor(next() * list.length)]!; return Array.from({ length: count }, (_, index) => { const weight = Math.round(next() * 9000) / 10; return { id: `SH-${3301 + index}`, customer: pick(CUSTOMERS), destination: pick(DESTINATIONS), carrier: pick(CARRIERS), status: pick(STATUSES), shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`, weight, cost: Math.round(weight * (2 + next() * 3) * 100) / 100, priority: next() < 0.3, }; });}const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const ROWS = shipments(12);export default function DataGridColumnState() { return ( <DataGrid aria-label="Shipments" columns={COLUMNS} rowKey="id" rows={ROWS} defaultColumnState={{ pinned: { start: ['id'], end: ['cost'] }, widths: { customer: 240 } }} height="24rem" selectionMode="multiple" /> );}Grouping
group in the query lists the columns rows are grouped by, one level per column. Each group row shows its value and how many rows it holds, and groups start open; ArrowLeft closes a group and ArrowRight opens it. A column with an aggregate also shows its total on each group row.
import { emptyQuery, type GridColumn, type GridQuery } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const DESTINATIONS = [ 'Berlin, DE', 'Marseille, FR', 'Graz, AT', 'Bräcke, SE', 'Rio de Janeiro, BR', 'Cowes, UK', 'Boise, US', 'Oulu, FI',];const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];function shipments(count: number): Shipment[] { let seed = 7; const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296; const pick = <T,>(list: readonly T[]) => list[Math.floor(next() * list.length)]!; return Array.from({ length: count }, (_, index) => { const weight = Math.round(next() * 9000) / 10; return { id: `SH-${3301 + index}`, customer: pick(CUSTOMERS), destination: pick(DESTINATIONS), carrier: pick(CARRIERS), status: pick(STATUSES), shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`, weight, cost: Math.round(weight * (2 + next() * 3) * 100) / 100, priority: next() < 0.3, }; });}const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const INITIAL_QUERY: GridQuery = { ...emptyQuery(), group: ['carrier'], sort: [{ column: 'id', direction: 'ascending' }],};const ROWS = shipments(20);export default function DataGridGrouping() { return ( <DataGrid aria-label="Shipments" columns={COLUMNS} rowKey="id" rows={ROWS} defaultQuery={INITIAL_QUERY} height="26rem" /> );}Totals
aggregate on a column (sum, avg, min, max, count, or a function of the values) adds a summary row with that column’s total over the rows the query left.
import type { GridColumn } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const DESTINATIONS = [ 'Berlin, DE', 'Marseille, FR', 'Graz, AT', 'Bräcke, SE', 'Rio de Janeiro, BR', 'Cowes, UK', 'Boise, US', 'Oulu, FI',];const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];function shipments(count: number): Shipment[] { let seed = 7; const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296; const pick = <T,>(list: readonly T[]) => list[Math.floor(next() * list.length)]!; return Array.from({ length: count }, (_, index) => { const weight = Math.round(next() * 9000) / 10; return { id: `SH-${3301 + index}`, customer: pick(CUSTOMERS), destination: pick(DESTINATIONS), carrier: pick(CARRIERS), status: pick(STATUSES), shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`, weight, cost: Math.round(weight * (2 + next() * 3) * 100) / 100, priority: next() < 0.3, }; });}const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const SUM_COLUMNS: GridColumn<Shipment>[] = COLUMNS.map((column) => column.id === 'weight' || column.id === 'cost' ? { ...column, aggregate: 'sum' as const } : column,);const ROWS = shipments(10);export default function DataGridSummary() { return ( <DataGrid aria-label="Shipments" columns={SUM_COLUMNS} rowKey="id" rows={ROWS} height="24rem" /> );}Row details
renderDetail (an slDataGridDetail template in Angular) adds an expander to each row and draws the detail under it. defaultExpanded opens rows on the first render.
import type { GridColumn } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';import { Text } from '@slotted/react/typography';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const DESTINATIONS = [ 'Berlin, DE', 'Marseille, FR', 'Graz, AT', 'Bräcke, SE', 'Rio de Janeiro, BR', 'Cowes, UK', 'Boise, US', 'Oulu, FI',];const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];function shipments(count: number): Shipment[] { let seed = 7; const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296; const pick = <T,>(list: readonly T[]) => list[Math.floor(next() * list.length)]!; return Array.from({ length: count }, (_, index) => { const weight = Math.round(next() * 9000) / 10; return { id: `SH-${3301 + index}`, customer: pick(CUSTOMERS), destination: pick(DESTINATIONS), carrier: pick(CARRIERS), status: pick(STATUSES), shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`, weight, cost: Math.round(weight * (2 + next() * 3) * 100) / 100, priority: next() < 0.3, }; });}const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const ROWS = shipments(8);export default function DataGridDetail() { return ( <DataGrid aria-label="Shipments" columns={COLUMNS} rowKey="id" rows={ROWS} defaultExpanded={['SH-3301']} height="26rem" renderDetail={(row) => ( <Text size="sm"> {row.carrier} picked up {row.weight.toFixed(1)} kg on {row.shipped} for {row.destination}. Charged {money(row.cost)}. </Text> )} /> );}Trees
tree with a parentKey function turns flat rows into a hierarchy: each row with children gets an expander in its first column, and the levels indent under it. onLoadChildren with hasChildren loads a level when it is first opened.
import type { GridColumn, GridTree } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';interface Location { id: string; parent: string | null; name: string; kind: string; units: number;}const LOCATIONS: Location[] = [ { id: 'reno', parent: null, name: 'Reno, NV', kind: 'Warehouse', units: 4210 }, { id: 'reno-a', parent: 'reno', name: 'Zone A — dry goods', kind: 'Zone', units: 2630 }, { id: 'reno-a-01', parent: 'reno-a', name: 'Aisle 01', kind: 'Aisle', units: 1410 }, { id: 'reno-a-02', parent: 'reno-a', name: 'Aisle 02', kind: 'Aisle', units: 1220 }, { id: 'reno-b', parent: 'reno', name: 'Zone B — chilled', kind: 'Zone', units: 1580 }, { id: 'columbus', parent: null, name: 'Columbus, OH', kind: 'Warehouse', units: 3075 }, { id: 'columbus-a', parent: 'columbus', name: 'Zone A — dry goods', kind: 'Zone', units: 3075 }, { id: 'savannah', parent: null, name: 'Savannah, GA', kind: 'Warehouse', units: 1890 }, { id: 'savannah-a', parent: 'savannah', name: 'Zone A — bonded', kind: 'Zone', units: 1890 },];const COLUMNS: GridColumn<Location>[] = [ { id: 'name', label: 'Location', accessor: 'name', rowHeader: true, flex: 1, minWidth: 220 }, { id: 'kind', label: 'Type', accessor: 'kind', width: 130 }, { id: 'units', label: 'Units on hand', accessor: 'units', kind: 'number', width: 150 },];const TREE: GridTree<Location> = { parentKey: (row) => row.parent };export default function DataGridTree() { return ( <DataGrid aria-label="Stock by location" columns={COLUMNS} defaultExpanded={['reno', 'reno-a']} height="22rem" rowKey="id" rows={LOCATIONS} tree={TREE} /> );}Ten thousand rows
The grid mounts only the rows and columns in view, so a set of ten thousand rows scrolls the same as a set of twenty. Sorting, filtering and selection cover every row, mounted or not.
import type { GridColumn } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const DESTINATIONS = [ 'Berlin, DE', 'Marseille, FR', 'Graz, AT', 'Bräcke, SE', 'Rio de Janeiro, BR', 'Cowes, UK', 'Boise, US', 'Oulu, FI',];const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];function shipments(count: number): Shipment[] { let seed = 7; const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296; const pick = <T,>(list: readonly T[]) => list[Math.floor(next() * list.length)]!; return Array.from({ length: count }, (_, index) => { const weight = Math.round(next() * 9000) / 10; return { id: `SH-${3301 + index}`, customer: pick(CUSTOMERS), destination: pick(DESTINATIONS), carrier: pick(CARRIERS), status: pick(STATUSES), shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`, weight, cost: Math.round(weight * (2 + next() * 3) * 100) / 100, priority: next() < 0.3, }; });}const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const ROWS = shipments(10_000);export default function DataGridVirtualization() { return ( <DataGrid aria-label="Shipments, 10,000 rows" columns={COLUMNS} rowKey="id" rows={ROWS} height="26rem" selectionMode="multiple" /> );}Empty
A grid with no rows shows a result state in place of the body. When a filter or a search left no rows, the message says so and offers to clear them.
import type { GridColumn } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const ROWS = [] as Shipment[];export default function DataGridEmpty() { return ( <DataGrid aria-label="Shipments" columns={COLUMNS} rowKey="id" rows={ROWS} height="18rem" /> );}Load error
error replaces the body with the message, and onRetry ((retry) in Angular) adds a Try again button.
The shipments service did not answer within 30 seconds.
import { useState } from 'react';import type { GridColumn } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const ROWS = [] as Shipment[];export default function DataGridError() { const [attempts, setAttempts] = useState(0); return ( <DataGrid aria-label="Shipments" columns={COLUMNS} rowKey="id" rows={ROWS} error="The shipments service did not answer within 30 seconds." height="18rem" onRetry={() => setAttempts(attempts + 1)} /> );}Loading
loading with no rows draws skeleton rows as wide as the visible columns. Over rows already shown, it dims the body and sets aria-busy, and nothing moves.
import type { GridColumn } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const ROWS = [] as Shipment[];export default function DataGridLoading() { return ( <DataGrid aria-label="Shipments" columns={COLUMNS} rowKey="id" rows={ROWS} height="18rem" loading /> );}Rich cells
cellRenderers (an slDataGridCell="<column id>" template in Angular) replaces what one column’s cells draw, with the row and the value in hand. The column keeps its sort, filter and search, which read the value rather than what the cell draws.
import type { GridColumn } from '@slotted/core/grid';import { Avatar } from '@slotted/react/avatar';import { Badge } from '@slotted/react/badge';import { DataGrid } from '@slotted/react/data-grid';import { Inline } from '@slotted/react/inline';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const DESTINATIONS = [ 'Berlin, DE', 'Marseille, FR', 'Graz, AT', 'Bräcke, SE', 'Rio de Janeiro, BR', 'Cowes, UK', 'Boise, US', 'Oulu, FI',];const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];function shipments(count: number): Shipment[] { let seed = 7; const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296; const pick = <T,>(list: readonly T[]) => list[Math.floor(next() * list.length)]!; return Array.from({ length: count }, (_, index) => { const weight = Math.round(next() * 9000) / 10; return { id: `SH-${3301 + index}`, customer: pick(CUSTOMERS), destination: pick(DESTINATIONS), carrier: pick(CARRIERS), status: pick(STATUSES), shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`, weight, cost: Math.round(weight * (2 + next() * 3) * 100) / 100, priority: next() < 0.3, }; });}const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const TONE: Record<string, 'secondary' | 'success' | 'danger' | 'warning'> = { 'In transit': 'secondary', Delivered: 'success', Delayed: 'danger', Customs: 'warning',};const ROWS = shipments(10);export default function DataGridContent() { return ( <DataGrid aria-label="Shipments" columns={COLUMNS} rowKey="id" rows={ROWS} cellRenderers={{ customer: ({ row }) => ( <Inline align="center" gap={2}> <Avatar name={row.customer} size="sm" /> {row.customer} </Inline> ), status: ({ value }) => ( <Badge tone={TONE[String(value)]} variant="soft"> {String(value)} </Badge> ), }} height="24rem" /> );}Opening a row
activatable with onActivate ((activate) in Angular) reports a double press on a row, or Enter on its text cell, so a row can open its record.
import { useState } from 'react';import type { GridColumn } from '@slotted/core/grid';import { DataGrid } from '@slotted/react/data-grid';import { Stack } from '@slotted/react/stack';import { Text } from '@slotted/react/typography';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const DESTINATIONS = [ 'Berlin, DE', 'Marseille, FR', 'Graz, AT', 'Bräcke, SE', 'Rio de Janeiro, BR', 'Cowes, UK', 'Boise, US', 'Oulu, FI',];const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];function shipments(count: number): Shipment[] { let seed = 7; const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296; const pick = <T,>(list: readonly T[]) => list[Math.floor(next() * list.length)]!; return Array.from({ length: count }, (_, index) => { const weight = Math.round(next() * 9000) / 10; return { id: `SH-${3301 + index}`, customer: pick(CUSTOMERS), destination: pick(DESTINATIONS), carrier: pick(CARRIERS), status: pick(STATUSES), shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`, weight, cost: Math.round(weight * (2 + next() * 3) * 100) / 100, priority: next() < 0.3, }; });}const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const ROWS = shipments(12);export default function DataGridActivation() { const [opened, setOpened] = useState<string | null>(null); return ( <Stack gap={3}> <Text size="sm" tone="muted"> {opened ? `Opened ${opened}` : 'Double-click a row, or press Enter on its shipment cell.'} </Text> <DataGrid aria-label="Shipments" columns={COLUMNS} rowKey="id" rows={ROWS} activatable height="22rem" onActivate={({ key }) => setOpened(key)} /> </Stack> );}Recipe: shipments workspace
A search field writes into the query, the grid selects rows, and the footer holds the bulk action for the selection.
import { useState } from 'react';import { emptyQuery, withSearch, type GridColumn, type GridQuery } from '@slotted/core/grid';import { Button } from '@slotted/react/button';import { DataGrid } from '@slotted/react/data-grid';import { Inline } from '@slotted/react/inline';import { Stack } from '@slotted/react/stack';import { TextField } from '@slotted/react/text-field';import { Text } from '@slotted/react/typography';interface Shipment { id: string; customer: string; destination: string; carrier: string; status: string; shipped: string; weight: number; cost: number; priority: boolean;}const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop', 'Wartian Herkku',];const DESTINATIONS = [ 'Berlin, DE', 'Marseille, FR', 'Graz, AT', 'Bräcke, SE', 'Rio de Janeiro, BR', 'Cowes, UK', 'Boise, US', 'Oulu, FI',];const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];function shipments(count: number): Shipment[] { let seed = 7; const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296; const pick = <T,>(list: readonly T[]) => list[Math.floor(next() * list.length)]!; return Array.from({ length: count }, (_, index) => { const weight = Math.round(next() * 9000) / 10; return { id: `SH-${3301 + index}`, customer: pick(CUSTOMERS), destination: pick(DESTINATIONS), carrier: pick(CARRIERS), status: pick(STATUSES), shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`, weight, cost: Math.round(weight * (2 + next() * 3) * 100) / 100, priority: next() < 0.3, }; });}const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');const COLUMNS: GridColumn<Shipment>[] = [ { id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' }, { id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 }, { id: 'destination', label: 'Destination', accessor: 'destination', width: 170 }, { id: 'carrier', label: 'Carrier', accessor: 'carrier', kind: 'set', width: 110, options: CARRIERS.map((value) => ({ value, label: value })), }, { id: 'status', label: 'Status', accessor: 'status', kind: 'set', width: 120, options: STATUSES.map((value) => ({ value, label: value })), }, { id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 }, { id: 'weight', label: 'Weight', accessor: 'weight', kind: 'number', width: 110, format: kilograms, }, { id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },];const ROWS = shipments(60);export default function DataGridShipmentsWorkspace() { const [query, setQuery] = useState<GridQuery>(emptyQuery()); const [value, setValue] = useState<string | readonly string[] | null>([]); const count = Array.isArray(value) ? value.length : 0; return ( <Stack gap={3}> <TextField aria-label="Search shipments" clearable onValueChange={(text) => setQuery((current) => withSearch(current, text).query)} placeholder="Search by shipment, customer or destination" value={query.search} /> <DataGrid aria-label="Shipments" columns={COLUMNS} rowKey="id" rows={ROWS} footer={ <Inline align="center" gap={3}> <Text size="sm" tone="muted"> {count} selected </Text> <Button disabled={count === 0} size="sm" variant="outline"> Print labels </Button> </Inline> } height="26rem" onQueryChange={setQuery} onValueChange={setValue} query={query} selectionMode="multiple" value={value} /> </Stack> );}Accessibility
| Key | Effect | Focus |
|---|---|---|
| Tab | enters the grid on the current cell — the last visited, or the first cell of the body — and leaves it to the next control of the page | the current cell, or the single widget inside it |
| ArrowRight | moves one cell to the right; on the last cell of the row it does not move; mirrored in a right-to-left document | the cell |
| ArrowLeft | the mirror of ArrowRight | the cell |
| ArrowDown | moves one cell down; from the header to the filter row, then the body; on the last row it does not move; mounts the row when it is outside the window | the cell |
| ArrowUp | moves one cell up; from the first body row to the filter row and the header; on the first header row it does not move | the cell |
| PageDown | moves down one view of rows, scrolling; on the last row it does not move | the cell |
| PageUp | moves up one view of rows, scrolling; on the first row it does not move | the cell |
| Home | moves to the first cell of the row | the cell |
| End | moves to the last cell of the row | the cell |
| Ctrl+Home | moves to the first cell of the first body row | the cell |
| Ctrl+End | moves to the last cell of the last row the query left, mounting it | the cell |
| Ctrl+Space | in range mode, selects the whole column; otherwise nothing | the cell |
| Shift+Space | in single and multiple, toggles the row; in range, selects the whole row | the cell |
| Ctrl+A | in multiple, selects every row the query left; in range, every cell; otherwise nothing | the cell |
| Shift+ArrowRight | in range, extends the range one cell to the right from the anchor | the cell moved to |
| Shift+ArrowLeft | in range, extends the range one cell to the left | the cell moved to |
| Shift+ArrowDown | in range, extends the range one cell down; in multiple, extends the row selection from the anchor | the cell moved to |
| Shift+ArrowUp | the mirror of Shift+ArrowDown | the cell moved to |
| Enter | on an editable cell, opens the editor; on a cell with widgets, focuses the first; on a text cell of an activatable row, activates it; on a column header, sorts the column | the editor, the widget, or the cell |
| F2 | opens the editor or enters the cell; a second F2 commits the draft and returns to the cell | the editor, then the cell |
| alphanumeric | on an editable text or number cell, opens the editor with the key as its first character | the editor |
| Escape | in an editor, cancels the draft and returns to the cell; in a widget, returns to the cell; with a range, clears it; during a drag, drag takes it | the cell |
| Enter | commits and moves one row down in the same column in cell mode; commits the row in row mode | the cell below, or the same cell |
| Tab | commits and moves to the next editable cell of the row; Shift+Tab back; on the last, commits and stays | the next editable cell |
| Space | toggles the row's checkbox; Shift+Space extends from the anchor | the cell |
| Shift+Enter | appends the column to the sort order instead of replacing it | the cell |
| Ctrl+Enter | opens the column menu | the first item of the menu, then back to the header |
| Shift+F10 | opens the column menu anchored to the header cell; the Menu key does the same | the first item of the menu, then back to the header |
| F2 | enters the header cell and focuses the first widget of column-actions — the column help, the filter trigger or the column menu; Tab and Shift+Tab cycle the cell's widgets, Escape or a second F2 returns to the cell. Enter on the header still sorts | the first widget of column-actions, then the cell |
| Ctrl+Shift+ArrowRight | widens the column by one step, announced | the cell |
| Ctrl+Shift+ArrowLeft | narrows the column by one step, announced | the cell |
| Ctrl+Shift+Enter | fits the column to its mounted cells | the cell |
| Alt+ArrowRight | moves the column one position later, through drag.moveBy | the cell |
| Alt+ArrowLeft | moves the column one position earlier | the cell |
| ArrowRight | opens the group or the detail; when already open, moves right as usual | the cell |
| ArrowLeft | closes it; when already closed, moves left as usual | the cell |
| Ctrl+C | copies the range, or the current cell, as tab-separated text; not intercepted while the page holds a text selection | the cell |
- `columns`, `disabledKeys` and a function `rowKey` are compared by identity: a new array or function on a render of the parent re-renders every mounted row, so declare them at module scope or memoize them. The renderers — `cellRenderers`, `editorRenderers`, `renderCell`, `renderEditor`, `renderHeader`, `renderGroup`, `renderDetail` — `messages` and `tree` are read when a row renders and may be written inline, and so may `isRowSelectable` and `isRowMuted`: a row renders again only when its own answer changes. A row renders again for its own row object, selection, cursor, edit or expansion, and for a change of `columns` or the language; a renderer whose output reads state outside its row is refreshed by memoizing `columns` on that state.
- The root is role="grid": a composite widget with one tab stop. The current cell — or the single simple widget inside it, a link, a button or a checkbox — is the only element with tabindex="0"; Tab enters there and leaves the grid to the next control of the page, which is what the APG requires of a grid and what a table cannot give.
- Every row carries aria-rowindex against aria-rowcount on the root, and every cell aria-colindex against aria-colcount, always: the grid windows its rows and columns, so the DOM is never the whole set, and the counts are what let a screen reader say “row 4,812 of 9,000”.
- aria-sort is written on the first sort key’s header only — the practice says more than one is ambiguous — and the whole order is announced through the live announcer: “Sorted by Carrier ascending, Weight descending”. A resize announces the column and its width; a filter announces its sentence through describeFilter; a copy announces the count.
- A cell that does not edit while others do carries aria-readonly="true"; a draft that fails carries aria-invalid and its message in the title. A selected row carries aria-selected; a cell in a range carries it too, and the root aria-multiselectable in multiple and range.
- A column with a description is described by it: the header carries aria-describedby to a visually hidden span, and the column menu points at the same span while showing the text aria-hidden, so the words are heard once. The column help is a button with a name — “About ARR” — reached by F2 on the header; Tab cycles the header’s widgets and Escape returns to the cell. Hiding a column is announced as “Carrier hidden”.
- The header checkbox names what it covers — “Select all 3,412 rows”, or the page in server mode — because a selection over a whole result set is a decision only the query can make. Every control the grid draws has a name: the column menu, the filter trigger, the expander, the group toggle, the operator symbol.
API
data-grid
Props
rowsreadonly Row[]- The records; the grid never mutates them. Left out when a dataSource answers for them.
rowKeykeyof Row | (row) => string- A field name or a function: the key every state model names a row by.
columnsGridColumn<Row>[]- The column model: id, label, description, kind, accessor, format, compare, width, minWidth, maxWidth, flex, priority, sortable, filterable, searchable, editable, resizable, reorderable, hideable, rowHeader, pinned (end by default for kind actions), options, aggregate, validate, parse — and help, a node for the column’s help popover.
descriptionstring- On DataGridColumnWhat the column is: the header’s accessible description, the caption atop its menu and the first line of its help popover.
helpReactNode- On DataGridColumnThe column’s own help, under the description in the popover the column-help button opens. Its presence alone draws the button.
prioritynumber- On DataGridColumnThe lower, the longer the column stays when the frame is too narrow. A column without one leaves before every numbered one; the identity column and an actions column never leave.
popinbooleanDefaulttrue- On DataGridColumnWhether a column with no room moves into the row’s pop-in; false hides it instead.
columnGroupsGridColumnGroup[]- Headings spanning columns, drawn as a row above the names.
mode'client' | 'server'Defaultinferred- client applies the query to rows; server draws rows as given. server when totalCount or hasMore is present.
totalCountnumber- The whole set’s size in server mode; aria-rowcount and the range read it.
hasMoreboolean- Whether a page past this one exists when the total is unknown; loadMoreTrigger decides what asks for it.
loadingboolean | 'initial' | 'refresh'Defaultfalse- Skeleton rows with no answer to keep; aria-busy over an answer already drawn — rows, which dim, or the empty state, which stays. true is initial until the grid has drawn an answer, and refresh after; rows emptied while a load starts wait in the skeleton.
errorstring | null- The message of a failed load; draws the error state with Try again when onRetry is set.
disabledKeysstring[]- Rows that are neither selectable nor editable, drawn with data-disabled.
isRowSelectable(row: Row) => boolean- Whether a row takes part in the selection. A row it refuses leaves the press, the Shift range, Ctrl+A and the header checkbox, and its checkbox is disabled. It keeps its ink, hover, activation and editing, which a row in disabledKeys loses.
isRowMuted(row: Row) => boolean- Draws a row that is no longer active, with data-muted: its cells, its pop-in and the links in them take --slotted-data-grid-color-muted. Hover, selection, activation and editing stay, and the selected ground stays under the muted ink.
queryGridQuery- sort, filter, search, page and group in one object. Present puts the query in controlled mode.
defaultQueryGridQueryDefaultemptyQuery()- The query an uncontrolled grid starts from, read once.
onQueryChange(query, request) => void- Asked before the query moves; the request carries change: sort | filter | search | page | group, the reason, and cancel().
columnStateGridColumnState- order, widths, hidden and pinned. Present puts the arrangement in controlled mode; it is normalized against columns.
defaultColumnStatePartial<GridColumnState>- The arrangement an uncontrolled grid starts from, read once.
onColumnStateChange(state, request) => void- Asked before the arrangement moves; the request carries change: order | width | hidden | pinned.
onManageColumns() => void- Called by the column menu’s Manage columns; the application opens its column-manager.
onOutOfSpaceChange(outOfSpace: GridOutOfSpace) => void- Called when the columns a narrow frame took out by priority change — those in the pop-in and those hidden. Never part of columnState.
density'comfortable' | 'compact' | 'dense' | nullDefault the page’s- This grid’s own density, written as data-slotted-density on the root; absent or null, the page’s.
selectionMode'none' | 'single' | 'multiple' | 'range'Defaultnone- Rows, one or many, with the checkbox column in multiple; or a rectangle of cells.
valuestring | string[] | null- The selected row (single) or rows (multiple). Present puts the selection in controlled mode.
defaultValuestring | string[] | null- The selection an uncontrolled grid starts from.
onValueChange(value, request) => void- Asked before the selection moves, with pointer, keyboard, select, clear or programmatic.
rangeGridRange | null- The cell rectangle as anchor and focus, in range mode. Present puts it in controlled mode.
defaultRangeGridRange | null- The rectangle an uncontrolled grid starts from.
onRangeChange(range, request) => void- Asked before the rectangle moves, with pointer, keyboard, clear or programmatic.
currentGridCell | null- Where the cursor stands: a row key (or header, filter, summary, group:<key>) and a column id. Present puts the cursor in controlled mode.
defaultCurrentGridCell | null- Where an uncontrolled cursor starts.
onCurrentChange(cell, request) => void- Asked before the cursor moves, with pointer, keyboard or programmatic.
expandedstring[]- The rows whose detail is open. Present puts it in controlled mode.
defaultExpandedstring[]- The open details an uncontrolled grid starts with.
onExpandedChange(keys, request) => void- Asked before a detail opens or closes.
expandedGroupsstring[] | 'all'- The open groups, or all. Present puts it in controlled mode.
defaultExpandedGroupsstring[] | 'all'Defaultall- The open groups an uncontrolled grid starts with: every group.
onExpandedGroupsChange(keys, request) => void- Asked before a group opens or closes.
expandableboolean | (row) => booleanDefault true with renderDetail- Which rows have a detail.
editMode'cell' | 'row'Defaultcell- One cell at a time, or every editable cell of the row.
onEditStart(cell) => void- An editor opened.
onEditCommit(commit) => void | Promise<void>- A draft committed: key, column, value, previous, row, reason and every change of the row. A rejected promise reopens the editor with the draft and the error.
onEditCancel(cell) => void- A draft cancelled.
activatablebooleanDefaultfalse- A double press or Enter on a text cell reports the row through onActivate.
onActivate(event) => void- The row’s key, the reason and the event.
filterRowbooleanDefaultfalse- The row of operands under the header.
filterDebouncenumberDefault300- Milliseconds a text or number operand in the filter row waits before it applies.
virtualize'auto' | booleanDefaultauto- auto windows rows above a hundred and middle columns above twenty.
rowHeightnumber | 'auto'Defaultdensity- Pixels per row, read once from the first row when unstated; auto measures every row, capped by --slotted-data-grid-row-max-block-size. While a pop-in is drawn every row is measured, as under auto.
columnOverflow'auto' | 'popin' | 'scroll'Defaultauto- What a frame too narrow for the template does: popin moves columns into each row’s pop-in by priority; scroll keeps them and scrolls sideways; auto pops in on a frame under 600px, or under 1024px when the main pointer is coarse — a phone, a small tablet — and scrolls elsewhere, where a mouse or a trackpad scrolls and the columns keep their layout.
overscannumberDefault6- Rows mounted past each edge of the window.
tree{ parentKey, column?, hasChildren? }- Rows as a tree, each naming its parent by key; the open branches are expanded and the root is a treegrid.
onLoadChildren({ key, row }) => void- Called when a branch hasChildren says has children opens and none are in rows.
dataSource{ getRows(query, { signal }), cacheSize? }- The grid asks for its own rows per query, aborting the request before, keeping answers by query; server mode with its own loading and error.
pinnedRows{ top?: string[], bottom?: string[] }- Rows held at the top or the bottom of the body, out of the query and always on screen.
rowsReorderablebooleanDefaultfalse- A grip per row; the pointer drags it and Alt with the vertical arrows moves it. Only while the query is at rest and without a tree.
onRowsReorder({ key, from, to, reason, event }) => void- Where a row goes in rows: from, and the index it takes once moved. The consumer moves it.
highlightChangesboolean | numberDefaultfalse- Marks a mounted cell whose value changed between two rows, for the stated milliseconds (true is 1200).
loadMoreThresholdnumberDefault20- Rows left below the window before onLoadMore is called.
onLoadMore() => void- Asked for the next page when hasMore is true.
loadMoreTrigger'scroll' | 'button' | 'both'Defaultscroll- What asks for the next page: nearing the end, with a loading status in the footer; a Load more control; or both.
loadMoreFailedbooleanDefaultfalse- The last page asked for failed: the automatic request stops and the footer offers Try again.
onRetry() => void- The error state’s Try again.
skeletonRowsnumberDefault8- Rows the first load draws.
pageSizesnumber[]Default25,50,100- The sizes a page-size control in the footer offers, read through useDataGridDefaults.
variant'plain' | 'ruled' | 'framed'Defaultruled- No rules, rules between rows, or the border and the radius.
stripedbooleanDefaultfalse- Every second row tinted.
stickyHeaderbooleanDefaulttrue- The header, the filter row and the summary stay while the rows scroll.
stickyTo'scroll' | 'page'Defaultscroll- What the header sticks inside: the grid’s own scroller, or the page — which gives up the grid’s own scrolling and windowing.
heightstring | number- The frame’s height; without one the grid grows to its rows.
labelledBystring- The id of the element that names the grid; a native aria-label names it directly, and with neither the grid is named by messages.grid.
messagesPartial<DataGridMessages>- Words laid over the language in force, key by key: every control, state and announcement, the grid’s name (grid), and filterYes and filterNo for a boolean cell. The operator names and symbols are the groups filterOperators and filterSymbols.
localestringDefault the language in force- BCP 47, for the collator, the number and the date formats.
timeZonestring- The zone a timestamp is read in.
renderCell(context) => ReactNode- What a cell draws; cellRenderers does it per column and wins.
renderEditor(context) => ReactNode- What a cell edits with; editorRenderers per column wins. The context carries draft, setDraft, commit and cancel.
renderHeader(context) => ReactNode- What a header draws in place of the label.
renderDetail(row, key) => ReactNode- A row’s detail; its presence draws the expander column.
renderGroup(context) => ReactNode- What a group row draws beside its toggle.
renderEmpty(status) => ReactNode- The empty, no-results or error state in place of the grid’s result state.
renderFilterOperand(context) => ReactNode- The operand control in the panel and the row, for a kind the grid has no field for.
footerReactNode- What stands in the bar under the grid, after the range.
showRangebooleanDefault when paged- Whether the footer states the range.
handleRefObject<DataGridHandle>- focusCell, scrollToRow, scrollToColumn, scrollToCell, startEdit, stopEdit, autofit (one column, or every resizable column as one request, reason programmatic), getOutOfSpace, getVisibleRows, toCsv, exportCsv, reload, selectAll, clearSelection, element.
align'start' | 'center' | 'end'Defaultstart- On GridColumnWhere the value sits; a number column sits at the end unless told otherwise.
numericbooleanDefaultfalse- On GridColumnTabular figures and end alignment; true for kind number.
text'wrap' | 'truncate' | 'nowrap'Defaulttruncate- On GridColumnWhat a long value does.
Events
| Name | Payload | When |
|---|---|---|
onQueryChange | (query: GridQuery, request: DataGridQueryRequest) | Before the query moves: a sort press, a filter applied, a search, a page, a group. request.change says which; the reason is pointer, keyboard, clear or programmatic; cancel() refuses it. |
onColumnStateChange | (state: GridColumnState, request: DataGridColumnStateRequest) | Before a column is resized, moved, hidden or pinned. request.change says which; the reason is pointer, keyboard or programmatic. A hide is announced; the columns in value.hidden and not in previous.hidden are what an undo shows again. |
onOutOfSpaceChange | (outOfSpace: GridOutOfSpace) | After the frame is measured, whenever the columns in the pop-in or the columns hidden for room change. |
onValueChange | (value: string | string[] | null, request) | Before the row selection moves: a checkbox press, Shift+Space, Ctrl+A, the header checkbox (reason select), or clearSelection (programmatic). |
onRangeChange | (range: GridRange | null, request) | Before the cell rectangle moves, or is cleared with Escape (reason clear). |
onCurrentChange | (cell: GridCell | null, request) | Before the cursor moves: an arrow key, a press, or the grid settling the cursor after its row left (programmatic). |
onExpandedChange | (keys: string[], request) | Before a detail opens or closes. |
onExpandedGroupsChange | (keys: string[] | 'all', request) | Before a group opens or closes. |
onEditStart / onEditCommit / onEditCancel | (cell) / (commit: DataGridEditCommit) / (cell) | When an editor opens; when a draft is committed by Enter, Tab, F2, a press elsewhere or blur (the commit may return a promise); when Escape cancels it. |
onActivate | (event: DataGridActivateEvent) | A double press or Enter on a text cell, or one touch or pen press, while activatable is true. |
onLoadMore / onRetry / onManageColumns | () | The window nears the end with hasMore; the error state’s Try again; the column menu’s Manage columns. |
Composition
DataGridDefaultsProvidercomponent- On ApplicationSets variant, striped, stickyHeader, stickyTo, selectionMode, editMode, filterRow, virtualize, rowHeight, columnOverflow, overscan, pageSizes, filterDebounce, loadMoreThreshold, loadMoreTrigger and skeletonRows once for a subtree. A grid that states one itself still wins. Its words and its locale come from the language in force (SlottedProvider).
@slotted/core/gridmodule- On ApplicationapplyQuery, emptyQuery, withSortPress, withColumnFilter, withSearch, withPageIndex, withGroup, toGridParams, fromGridParams, normalizeColumnState, serializeColumnState, parseColumnState: the engine the grid runs on, for a server mock, a URL and a saved view.
renderCell, renderEditor, renderHeader, renderDetail, renderGroup, renderEmpty, renderFilterOperandrender props- Every surface a consumer replaces, per grid or per column through cellRenderers and editorRenderers. row, cell, head and body are fixed: the layout and the roles are theirs.
footerReactNode- Pagination, a page-size select, a count: the consumer’s own controls in the bar the grid draws.
handleDataGridHandle- The imperative surface for what cannot be said declaratively: focusCell, scrollToRow, scrollToColumn, startEdit, stopEdit, autofit, getOutOfSpace, getVisibleRows, toCsv, exportCsv, reload, selectAll, clearSelection.
native propsattributes- Anything a div takes reaches the root; a consumer’s onKeyDown runs before the grid’s and preventDefault stops it. ref reaches the root element.
FilterBar, Pagination, ColumnManagerfamilies- On Beside the gridThe bar edits query.filter; pagination moves query.page in the footer; column-manager edits columnState.
Parts
| Part | Element | Required | Purpose |
|---|---|---|---|
root | div[role="grid"] | Yes | The frame and the widget: data-ui="data-grid", every axis, aria-rowcount, aria-colcount, aria-multiselectable, aria-busy, and the column template as --slotted-data-grid-template. |
scroll | div | Yes | The scroller on both axes, and the window the virtualiser measures. Carries data-overflowing, data-at-start and data-at-end while the columns overflow. |
head | div[role="rowgroup"] | Yes | The header rows, sticky to the top of the scroller by default. |
header-row | div[role="row"] | Yes | One row of the header: the column groups, or the column names. |
column-group | div[role="columnheader"] | No | A group heading spanning its columns through aria-colspan. |
column-header | div[role="columnheader"] | Yes | A column’s name and its controls. Carries aria-sort on the first sort key, data-sorted, data-filtered, data-pinned, data-dragging, data-drop-target and data-resizing. The name truncates, and a name its box cuts opens a hint with the whole of it — shown rather than read, because the header already states the words. |
sort | span | No | The direction mark on a sorted column, with data-index when the order holds more than one key. |
column-description | span | No | The column’s description, visually hidden, referenced by the header’s aria-describedby and by the column menu’s; present whenever the column has a description. |
column-actions | span | No | The slot at the trailing edge holding the column help, the filter trigger and the column menu. F2 on the header enters it, Tab cycles it, Escape leaves it. |
column-help | button | No | The circled question mark on a column with a description or a help node, always shown. Opens a popover by click, Enter or Space — never by hover — holding both. |
column-menu | button | No | Opens the column’s menu: sort, filter, pin, fit, fit all, hide, manage. |
column-menu-description | div[aria-hidden] | No | The description again, as a muted caption atop the column menu; hidden from the reader, who hears it once through the menu’s aria-describedby. |
resizer | div[aria-hidden] | No | The pointer’s handle on the trailing edge; a double press fits the column. |
resize-guide | div[aria-hidden] | No | The line a drag of the resizer moves by translate across the scroller’s height; the width is applied on release. |
drop-indicator | div | No | The line between two columns while one is dragged. |
filter-row | div[role="row"] | No | The row under the header, with filterRow, holding one operand per filterable column. |
filter-cell | div[role="gridcell"] | No | One cell of the filter row; data-filtered while its column has a rule. |
filter | button | No | The funnel on a filtered column, and the shortest way back to its panel. |
filter-panel | div | No | The compact panel in a popover, carrying data-ui itself because it is rendered outside the root. |
filter-condition | div | No | One line of the panel: the operator and its operand(s); data-operands says how many. |
filter-operator | div | No | The operator chooser: a select in the panel, a symbol button in the row. |
filter-operand | div | No | The operand control(s), with data-kind and data-range for a between. |
filter-join | div | No | And / Or between the two conditions of the panel. |
filter-actions | div | No | Clear and Apply. |
body | div[role="rowgroup"] | Yes | The rows; carries the virtual window’s total height and start offset. |
pinned-rows | div[role="rowgroup"] | No | Rows held under the head or over the summary, out of the query. |
row | div[role="row"] | Yes | One record: aria-rowindex, aria-selected, data-selected, data-current, data-expanded, data-editing, data-disabled. |
row-header | div[role="rowheader"] | No | The cell of the column marked rowHeader, which a screen reader repeats for the record. |
cell | div[role="gridcell"] | Yes | One value: aria-colindex, data-align, data-numeric, data-text, data-pinned, data-current, data-in-range, data-range-edge, data-editing, data-invalid, data-loading, data-readonly. |
editor | div | No | The control editing a cell, plain and sm, filling it. |
selection | div[role="gridcell"] | No | The checkbox column, always pinned to the start; in the header it selects every row the query left. |
expander | button | No | Opens a row’s detail; aria-expanded and aria-controls. |
detail | div[role="row"] | No | The open detail: one cell spanning every column, held to the frame’s width. |
popin-header | div[role="columnheader"] | No | The pop-in’s column, last in the header row while columns are out of space: messages.popinHeader, visually hidden, with no track. |
popin | div[role="gridcell"] | No | The last cell of a record’s row and of the summary while columns are out of space: the row’s second line, every track, held to the frame’s width; aria-colindex is the last. |
popin-field | div | No | One column in the pop-in, in the order of the columns: its label over its value. |
popin-label | span | No | The column’s label, in the small muted type; left out for a column with none. |
popin-value | div | No | The value, drawn by the column’s cell renderer with the cell’s own context; an editable column is read only here. |
group-row | div[role="row"] | No | A group heading: aria-level, aria-expanded, the value, the count, the aggregates. |
group-toggle | button | No | Opens and closes a group. |
tree-toggle | button | No | Opens and closes a tree row’s children; a leaf keeps its room empty. |
row-handle | button | No | The grip a row is dragged by; disabled while the query is not at rest. |
summary | div[role="rowgroup"] | No | The aggregates of the whole query, pinned to the end. |
summary-cell | div[role="gridcell"] | No | One aggregate. |
empty | div | No | The result-state for no rows, no results or an error, held to the frame’s width. |
loader | div[role="rowgroup"] | No | Skeleton rows on a first load. |
footer | div | No | The bar under the grid: the range, the consumer’s pagination, load more. |
actions | div | No | Row actions inside a cell of kind actions, revealed by hover and by the cursor. |
Theming
Each token is a CSS custom property: set it in a theme, or on any element to retune every data grid inside it.
Data grid tokens
| Token | Default |
|---|---|
--slotted-data-grid-band-surface | color-mix(in oklab, var(--slotted-text, CanvasText) 4%, var(--_surface)) |
--slotted-data-grid-block-size | auto |
--slotted-data-grid-border-color | var(--slotted-border-subtle, ButtonBorder) |
--slotted-data-grid-border-color-strong | var(--slotted-border-strong, ButtonBorder) |
--slotted-data-grid-border-width | var(--slotted-border-width-thin, 1px) |
--slotted-data-grid-cell-padding-block | max( var(--slotted-space-2, 0.25rem), calc((var(--_head-block) - var(--_font-size) * var(--slotted-line-height-md, 1.5)) / 2) ) |
--slotted-data-grid-cell-padding-inline | var(--slotted-control-padding-inline-md, 13px) |
--slotted-data-grid-changed-surface | color-mix(in oklab, var(--slotted-tone-accent-solid, Highlight) 24%, transparent) |
--slotted-data-grid-color | var(--slotted-text, CanvasText) |
--slotted-data-grid-color-muted | var(--slotted-text-muted, GrayText) |
--slotted-data-grid-control-radius | var(--slotted-radius-sm, 4px) |
--slotted-data-grid-cursor-color | var(--slotted-tone-accent-border, Highlight) |
--slotted-data-grid-filter-operator-size | 7rem |
--slotted-data-grid-filter-panel-size | 24rem |
--slotted-data-grid-filter-panel-size-date | 28rem |
--slotted-data-grid-filter-panel-size-datetime | 34rem |
--slotted-data-grid-font-family | var(--slotted-control-font-family) |
--slotted-data-grid-font-size | var(--slotted-control-font-size-md, 13px) |
--slotted-data-grid-gap | var(--slotted-control-gap-md, 8px) |
--slotted-data-grid-head-block-size | var(--slotted-control-height-md, 34px) |
--slotted-data-grid-header-surface | color-mix(in oklab, var(--slotted-text, CanvasText) 8%, var(--_surface)) |
--slotted-data-grid-header-surface-hover | color-mix(in oklab, var(--slotted-text, CanvasText) 7%, var(--_head-surface)) |
--slotted-data-grid-icon-size | var(--slotted-control-icon-size-md, 16px) |
--slotted-data-grid-indent | var(--slotted-space-6, 1rem) |
--slotted-data-grid-pin-shadow-color | color-mix(in oklab, var(--slotted-scrim, rgb(0 0 0 / 0.5)) 22%, transparent) |
--slotted-data-grid-pin-shadow-size | var(--slotted-space-5, 0.75rem) |
--slotted-data-grid-radius | var(--slotted-radius-md, 6px) |
--slotted-data-grid-range-surface | var(--slotted-tone-accent-surface, Canvas) |
--slotted-data-grid-resize-guide-color | var(--slotted-focus-ring-color, Highlight) |
--slotted-data-grid-resize-guide-width | var(--slotted-border-width-thick, 2px) |
--slotted-data-grid-row-block-size | var(--_head-block) |
--slotted-data-grid-row-border-color-selected | var(--slotted-tone-accent-border, Highlight) |
--slotted-data-grid-row-color-selected | var(--_text) |
--slotted-data-grid-row-max-block-size | calc(var(--_row-block) * 4) |
--slotted-data-grid-row-surface-hover | var(--slotted-tone-secondary-subtle-hover, ButtonFace) |
--slotted-data-grid-row-surface-selected | color-mix(in oklab, var(--_selected-edge) 20%, var(--_surface)) |
--slotted-data-grid-row-surface-selected-hover | color-mix(in oklab, var(--_selected-edge) 28%, var(--_surface)) |
--slotted-data-grid-row-surface-stripe | color-mix(in oklab, var(--slotted-text, CanvasText) 5%, var(--_surface)) |
--slotted-data-grid-shadow | var(--slotted-shadow-xs, none) |
--slotted-data-grid-sticky-offset | 0 |
--slotted-data-grid-sticky-offset-end | 0 |
--slotted-data-grid-surface | var(--slotted-ground, var(--slotted-surface, Canvas)) |
Theme tokens it reads
| Token | Default |
|---|---|
--slotted-border-strong | Set per scheme by the theme |
--slotted-border-subtle | Set per scheme by the theme |
--slotted-border-width-thick | 2px |
--slotted-border-width-thin | 1px |
--slotted-control-font-family | var(--slotted-font-family-sans) |
--slotted-control-font-size-md | comfortable 13px · compact 12px · dense 12px |
--slotted-control-font-size-sm | comfortable 12px · compact 12px · dense 12px |
--slotted-control-gap-md | comfortable 8px · compact 6px · dense 4px |
--slotted-control-height-lg | comfortable 38px · compact 32px · dense 30px |
--slotted-control-height-md | comfortable 34px · compact 28px · dense 26px |
--slotted-control-height-sm | comfortable 30px · compact 26px · dense 24px |
--slotted-control-icon-size-md | comfortable 16px · compact 14px · dense 13px |
--slotted-control-inner-size-sm | comfortable 22px · compact 18px · dense 16px |
--slotted-control-invalid-edge-width | var(--slotted-border-width-thin) |
--slotted-control-padding-inline-md | comfortable 13px · compact 10px · dense 8px |
--slotted-control-padding-inline-sm | comfortable 10px · compact 8px · dense 6px |
--slotted-control-transition-duration | var(--slotted-duration-short) |
--slotted-control-transition-easing | var(--slotted-easing-standard) |
--slotted-disabled-foreground | Set per scheme by the theme |
--slotted-duration-long | 320ms |
--slotted-duration-loop | 1.1s |
--slotted-duration-short | 120ms |
--slotted-easing-standard | cubic-bezier(0.2, 0, 0, 1) |
--slotted-focus-ring-color | Set per scheme by the theme |
--slotted-focus-ring-color-invalid | Set per scheme by the theme |
--slotted-focus-ring-offset | var(--slotted-border-width-thick) |
--slotted-focus-ring-width | var(--slotted-border-width-thick) |
--slotted-font-size-xs | 0.75rem |
--slotted-font-weight-medium | 500 |
--slotted-font-weight-regular | 400 |
--slotted-font-weight-semibold | 600 |
--slotted-ground | var(--slotted-surface, Canvas) |
--slotted-line-height-md | 1.5 |
--slotted-popover-gap | 0.5rem |
--slotted-popover-padding-block-sm | var(--slotted-space-4, 0.5rem) |
--slotted-popover-padding-inline-sm | var(--slotted-space-5, 0.75rem) |
--slotted-radius-md | 6px |
--slotted-radius-sm | 4px |
--slotted-scrim | Set per scheme by the theme |
--slotted-shadow-xs | Set per scheme by the theme |
--slotted-space-1 | 0.125rem |
--slotted-space-2 | 0.25rem |
--slotted-space-3 | 0.375rem |
--slotted-space-4 | 0.5rem |
--slotted-space-5 | 0.75rem |
--slotted-space-6 | 1rem |
--slotted-space-8 | 1.5rem |
--slotted-surface | Set per scheme by the theme |
--slotted-surface-sunken | Set per scheme by the theme |
--slotted-target-comfortable | 44px |
--slotted-target-min | 24px |
--slotted-text | Set per scheme by the theme |
--slotted-text-muted | Set per scheme by the theme |
--slotted-tone-accent-border | Set per scheme by the theme |
--slotted-tone-accent-solid | Set per scheme by the theme |
--slotted-tone-accent-surface | Set per scheme by the theme |
--slotted-tone-accent-text | Set per scheme by the theme |
--slotted-tone-danger-border | Set per scheme by the theme |
--slotted-tone-secondary-subtle-hover | Set per scheme by the theme |
--slotted-z-index-sticky | 100 |