Table
A native HTML table for records a reader compares across columns, with sorting, column filters, row selection, expandable rows, sticky edges and the loading and empty states around them.
| Order | Customer | Warehouse | Status | Total |
|---|---|---|---|---|
| SO-10421 | Alfreds Futterkiste | Reno | Shipped | $1,240.00 |
| SO-10422 | Bon app' | Columbus | Processing | $860.50 |
| SO-10423 | Ernst Handel | Savannah | On hold | $3,410.25 |
| SO-10424 | Folk och fä HB | Reno | Delivered | $512.00 |
| SO-10425 | QUICK-Stop | Columbus | Shipped | $2,088.90 |
import { Table, TableBody, TableCaption, TableCell, TableColumnHeader, TableContent, TableHead, TableRow, TableRowHeader,} from '@slotted/react/table';import { Tag } from '@slotted/react/tag';const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const TONE = { Delivered: 'success', 'On hold': 'warning', Processing: 'accent', Shipped: 'secondary',} as const;const ORDERS = [ { id: 'SO-10421', customer: 'Alfreds Futterkiste', warehouse: 'Reno', status: 'Shipped', total: 1240, }, { id: 'SO-10422', customer: "Bon app'", warehouse: 'Columbus', status: 'Processing', total: 860.5, }, { id: 'SO-10423', customer: 'Ernst Handel', warehouse: 'Savannah', status: 'On hold', total: 3410.25, }, { id: 'SO-10424', customer: 'Folk och fä HB', warehouse: 'Reno', status: 'Delivered', total: 512, }, { id: 'SO-10425', customer: 'QUICK-Stop', warehouse: 'Columbus', status: 'Shipped', total: 2088.9, },] as const;export default function TableBasic() { return ( <Table columns={5}> <TableContent> <TableCaption>Orders placed today</TableCaption> <TableHead> <TableRow> <TableColumnHeader>Order</TableColumnHeader> <TableColumnHeader>Customer</TableColumnHeader> <TableColumnHeader>Warehouse</TableColumnHeader> <TableColumnHeader>Status</TableColumnHeader> <TableColumnHeader numeric>Total</TableColumnHeader> </TableRow> </TableHead> <TableBody> {ORDERS.map((order) => ( <TableRow key={order.id} value={order.id}> <TableRowHeader text="nowrap">{order.id}</TableRowHeader> <TableCell>{order.customer}</TableCell> <TableCell>{order.warehouse}</TableCell> <TableCell> <Tag tone={TONE[order.status]}>{order.status}</Tag> </TableCell> <TableCell numeric>{USD.format(order.total)}</TableCell> </TableRow> ))} </TableBody> </TableContent> </Table> );}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 { Table, TableBody, TableCaption, TableCell, TableColumnActions, TableColumnHeader, TableContent, TableDefaultsProvider, TableDetail, TableEmpty, TableExpander, TableFooter, TableGroupRow, TableHead, TableLoader, TableMark, TableRow, TableRowHeader, TableSelect, TableSelectAll, TableSort, TableSummary } from '@slotted/react';Table or data grid
A table is a document structure: every control inside it, a sort button, a checkbox or an expander, is its own Tab stop, and the arrow keys scroll the page or the table rather than move between cells. Use it for listings, reports and records that a reader reads and acts on row by row. Use the data grid when the reader moves between cells with the arrow keys, edits a spreadsheet of values, or the set runs to thousands of rows that need virtualization.
Variants
variant sets how much of the box the table draws. plain draws no frame and no rules, for a table inside a card that already draws one. ruled, the default, draws a rule between rows and none around the set. framed draws a border and a radius around the table and its footer, which is the form a listing screen takes.
| Shipment | Carrier | Cartons |
|---|---|---|
| SH-3301 | UPS Ground | 12 |
| SH-3302 | FedEx Express | 3 |
| SH-3303 | USPS Priority | 1 |
| Shipment | Carrier | Cartons |
|---|---|---|
| SH-3301 | UPS Ground | 12 |
| SH-3302 | FedEx Express | 3 |
| SH-3303 | USPS Priority | 1 |
| Shipment | Carrier | Cartons |
|---|---|---|
| SH-3301 | UPS Ground | 12 |
| SH-3302 | FedEx Express | 3 |
| SH-3303 | USPS Priority | 1 |
import { Stack } from '@slotted/react/stack';import { Table, TableBody, TableCaption, TableCell, TableColumnHeader, TableContent, TableHead, TableRow, TableRowHeader,} from '@slotted/react/table';const SHIPMENTS = [ { id: 'SH-3301', carrier: 'UPS Ground', cartons: 12 }, { id: 'SH-3302', carrier: 'FedEx Express', cartons: 3 }, { id: 'SH-3303', carrier: 'USPS Priority', cartons: 1 },];const VARIANTS = [ { variant: 'plain', caption: 'Plain: inside a card that already draws the box' }, { variant: 'ruled', caption: 'Ruled: the default, a rule between rows' }, { variant: 'framed', caption: 'Framed: the table is its own panel' },] as const;export default function TableVariants() { return ( <Stack gap={6}> {VARIANTS.map(({ variant, caption }) => ( <Table columns={3} key={variant} variant={variant}> <TableContent> <TableCaption>{caption}</TableCaption> <TableHead> <TableRow> <TableColumnHeader>Shipment</TableColumnHeader> <TableColumnHeader>Carrier</TableColumnHeader> <TableColumnHeader numeric>Cartons</TableColumnHeader> </TableRow> </TableHead> <TableBody> {SHIPMENTS.map((shipment) => ( <TableRow key={shipment.id} value={shipment.id}> <TableRowHeader>{shipment.id}</TableRowHeader> <TableCell>{shipment.carrier}</TableCell> <TableCell numeric>{shipment.cartons}</TableCell> </TableRow> ))} </TableBody> </TableContent> </Table> ))} </Stack> );}Striped rows
striped tints every other row, which carries the eye across a wide row. Hover, selection and focus paint over the stripe, so a striped row that is selected still reads as selected.
| SKU | Product | Warehouse | On hand | Reserved |
|---|---|---|---|---|
| PRD-0412 | Chai | Reno | 390 | 42 |
| PRD-0413 | Chang | Reno | 170 | 12 |
| PRD-0414 | Aniseed Syrup | Columbus | 130 | 70 |
| PRD-0415 | Chef Anton's Cajun Seasoning | Savannah | 530 | 0 |
| PRD-0416 | Grandma's Boysenberry Spread | Columbus | 120 | 25 |
| PRD-0417 | Northwoods Cranberry Sauce | Reno | 60 | 60 |
import { Table, TableBody, TableCell, TableColumnHeader, TableContent, TableHead, TableRow, TableRowHeader,} from '@slotted/react/table';const STOCK = [ { sku: 'PRD-0412', product: 'Chai', warehouse: 'Reno', onHand: 390, reserved: 42 }, { sku: 'PRD-0413', product: 'Chang', warehouse: 'Reno', onHand: 170, reserved: 12 }, { sku: 'PRD-0414', product: 'Aniseed Syrup', warehouse: 'Columbus', onHand: 130, reserved: 70 }, { sku: 'PRD-0415', product: "Chef Anton's Cajun Seasoning", warehouse: 'Savannah', onHand: 530, reserved: 0, }, { sku: 'PRD-0416', product: "Grandma's Boysenberry Spread", warehouse: 'Columbus', onHand: 120, reserved: 25, }, { sku: 'PRD-0417', product: 'Northwoods Cranberry Sauce', warehouse: 'Reno', onHand: 60, reserved: 60, },];export default function TableStriped() { return ( <Table columns={5} striped> <TableContent aria-label="Stock on hand"> <TableHead> <TableRow> <TableColumnHeader>SKU</TableColumnHeader> <TableColumnHeader>Product</TableColumnHeader> <TableColumnHeader>Warehouse</TableColumnHeader> <TableColumnHeader numeric>On hand</TableColumnHeader> <TableColumnHeader numeric>Reserved</TableColumnHeader> </TableRow> </TableHead> <TableBody> {STOCK.map((item) => ( <TableRow key={item.sku} value={item.sku}> <TableRowHeader text="nowrap">{item.sku}</TableRowHeader> <TableCell>{item.product}</TableCell> <TableCell>{item.warehouse}</TableCell> <TableCell numeric>{item.onHand}</TableCell> <TableCell numeric>{item.reserved}</TableCell> </TableRow> ))} </TableBody> </TableContent> </Table> );}Alignment and numbers
numeric on a header and its cells aligns the column to the end and sets tabular figures, so amounts line up digit under digit. align places any other column at start, center or end; set it on the header and on each cell of the column.
| Customer | Region | Due | Amount |
|---|---|---|---|
| Alfreds Futterkiste | EU | Oct 4 | $1,240.00 |
| Great Lakes Food Market | NA | Oct 9 | $18,402.75 |
| Hanari Carnes | SA | Oct 12 | $86.40 |
import { Table, TableBody, TableCell, TableColumnHeader, TableContent, TableHead, TableRow, TableRowHeader,} from '@slotted/react/table';const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const INVOICES = [ { id: 'INV-2041', customer: 'Alfreds Futterkiste', region: 'EU', due: 'Oct 4', amount: 1240 }, { id: 'INV-2042', customer: 'Great Lakes Food Market', region: 'NA', due: 'Oct 9', amount: 18402.75, }, { id: 'INV-2043', customer: 'Hanari Carnes', region: 'SA', due: 'Oct 12', amount: 86.4 },];export default function TableAlignment() { return ( <Table columns={4}> <TableContent aria-label="Invoices due"> <TableHead> <TableRow> <TableColumnHeader>Customer</TableColumnHeader> <TableColumnHeader align="center">Region</TableColumnHeader> <TableColumnHeader align="end">Due</TableColumnHeader> <TableColumnHeader numeric>Amount</TableColumnHeader> </TableRow> </TableHead> <TableBody> {INVOICES.map((invoice) => ( <TableRow key={invoice.id} value={invoice.id}> <TableRowHeader>{invoice.customer}</TableRowHeader> <TableCell align="center">{invoice.region}</TableCell> <TableCell align="end">{invoice.due}</TableCell> <TableCell numeric>{USD.format(invoice.amount)}</TableCell> </TableRow> ))} </TableBody> </TableContent> </Table> );}Long text
text decides what a cell does with text longer than its column: wrap (the default) breaks it onto more lines, truncate cuts it with an ellipsis on one line, and nowrap keeps it on one line and widens the column. layout="fixed" gives every column the same share of the width instead of sizing columns by their content.
| Order | Note | Tracking |
|---|---|---|
| SO-10421 | Leave at the loading dock behind the warehouse; the front office closes at noon on Fridays. | 1Z999AA10123456784 |
| SO-10422 | Customer asked for the invoice to be emailed to accounts payable rather than printed. | 1Z999AA10123456785 |
import { Table, TableBody, TableCell, TableColumnHeader, TableContent, TableHead, TableRow, TableRowHeader,} from '@slotted/react/table';const NOTES = [ { id: 'SO-10421', note: 'Leave at the loading dock behind the warehouse; the front office closes at noon on Fridays.', tracking: '1Z999AA10123456784', }, { id: 'SO-10422', note: 'Customer asked for the invoice to be emailed to accounts payable rather than printed.', tracking: '1Z999AA10123456785', },];export default function TableText() { return ( <Table columns={3} layout="fixed"> <TableContent aria-label="Delivery notes"> <TableHead> <TableRow> <TableColumnHeader>Order</TableColumnHeader> <TableColumnHeader>Note</TableColumnHeader> <TableColumnHeader>Tracking</TableColumnHeader> </TableRow> </TableHead> <TableBody> {NOTES.map((row) => ( <TableRow key={row.id} value={row.id}> <TableRowHeader text="nowrap">{row.id}</TableRowHeader> <TableCell text="truncate">{row.note}</TableCell> <TableCell text="wrap">{row.tracking}</TableCell> </TableRow> ))} </TableBody> </TableContent> </Table> );}Sorting
Put a TableSort (slTableSort in Angular) in each header that sorts, and give the header a column. Pressing it moves through ascending, descending and back to unsorted. The table holds the sort state and reports it through onSortChange ([(sort)] in Angular); the rows are yours to sort, so the order matches whatever your query does.
| SO-10424 | Folk och fä HB | 2026-09-30 | $512.00 |
|---|---|---|---|
| SO-10422 | Bon app' | 2026-09-29 | $860.50 |
| SO-10421 | Alfreds Futterkiste | 2026-09-28 | $1,240.00 |
| SO-10423 | Ernst Handel | 2026-09-27 | $3,410.25 |
import { useMemo, useState } from 'react';import { Table, TableBody, TableCell, TableColumnHeader, TableContent, TableHead, TableRow, TableRowHeader, TableSort, type TableSortDescriptor,} from '@slotted/react/table';const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const ORDERS = [ { id: 'SO-10421', customer: 'Alfreds Futterkiste', placed: '2026-09-28', total: 1240 }, { id: 'SO-10422', customer: "Bon app'", placed: '2026-09-29', total: 860.5 }, { id: 'SO-10423', customer: 'Ernst Handel', placed: '2026-09-27', total: 3410.25 }, { id: 'SO-10424', customer: 'Folk och fä HB', placed: '2026-09-30', total: 512 },];type Order = (typeof ORDERS)[number];function sortOrders(rows: readonly Order[], sort: TableSortDescriptor | null): readonly Order[] { if (sort === null) return rows; const key = sort.column as keyof Order; const sign = sort.direction === 'ascending' ? 1 : -1; return [...rows].sort((a, b) => typeof a[key] === 'number' ? ((a[key] as number) - (b[key] as number)) * sign : String(a[key]).localeCompare(String(b[key])) * sign, );}export default function TableSorting() { const [sort, setSort] = useState<TableSortDescriptor | null>({ column: 'placed', direction: 'descending', }); const rows = useMemo(() => sortOrders(ORDERS, sort), [sort]); return ( <Table columns={4} onSortChange={setSort} sort={sort}> <TableContent aria-label="Recent orders"> <TableHead> <TableRow> <TableColumnHeader column="id"> <TableSort>Order</TableSort> </TableColumnHeader> <TableColumnHeader column="customer"> <TableSort>Customer</TableSort> </TableColumnHeader> <TableColumnHeader column="placed"> <TableSort>Placed</TableSort> </TableColumnHeader> <TableColumnHeader column="total" numeric> <TableSort>Total</TableSort> </TableColumnHeader> </TableRow> </TableHead> <TableBody> {rows.map((order) => ( <TableRow key={order.id} value={order.id}> <TableRowHeader text="nowrap">{order.id}</TableRowHeader> <TableCell>{order.customer}</TableCell> <TableCell text="nowrap">{order.placed}</TableCell> <TableCell numeric>{USD.format(order.total)}</TableCell> </TableRow> ))} </TableBody> </TableContent> </Table> );}Column filters
A filter sits in the header of the column it filters, inside TableColumnActions. TableSetFilter lists the values the column holds, with the counts you supply; ticking values edits a draft, and only Apply reports the new filter, so one query runs for several changes. Escape or a press outside restores the filter the panel opened with. Past eight values the panel adds a search field. The table filters nothing itself: createFilterPredicate from @slotted/core/filter turns the reported filter into a test for your rows.
| Order | Customer | Warehouse | Status |
|---|---|---|---|
| SO-10421 | Alfreds Futterkiste | Reno | Shipped |
| SO-10422 | Bon app' | Columbus | Processing |
| SO-10423 | Ernst Handel | Savannah | On hold |
| SO-10424 | Folk och fä HB | Reno | Delivered |
| SO-10425 | QUICK-Stop | Columbus | Shipped |
| SO-10426 | Hanari Carnes | Savannah | Processing |
import { useMemo, useState } from 'react';import { createFilterPredicate, type SetFilter } from '@slotted/core/filter';import { Table, TableBody, TableCell, TableColumnActions, TableColumnHeader, TableContent, TableHead, TableRow, TableRowHeader, TableSetFilter,} from '@slotted/react/table';const ORDERS = [ { id: 'SO-10421', customer: 'Alfreds Futterkiste', warehouse: 'Reno', status: 'Shipped' }, { id: 'SO-10422', customer: "Bon app'", warehouse: 'Columbus', status: 'Processing' }, { id: 'SO-10423', customer: 'Ernst Handel', warehouse: 'Savannah', status: 'On hold' }, { id: 'SO-10424', customer: 'Folk och fä HB', warehouse: 'Reno', status: 'Delivered' }, { id: 'SO-10425', customer: 'QUICK-Stop', warehouse: 'Columbus', status: 'Shipped' }, { id: 'SO-10426', customer: 'Hanari Carnes', warehouse: 'Savannah', status: 'Processing' },];const STATUSES = ['Processing', 'On hold', 'Shipped', 'Delivered'].map((value) => ({ value, count: ORDERS.filter((order) => order.status === value).length,}));export default function TableFilter() { const [status, setStatus] = useState<SetFilter | null>(null); const rows = useMemo(() => { const keep = createFilterPredicate(status); return ORDERS.filter((order) => keep(order.status)); }, [status]); return ( <Table columns={4}> <TableContent aria-label="Open orders"> <TableHead> <TableRow> <TableColumnHeader>Order</TableColumnHeader> <TableColumnHeader>Customer</TableColumnHeader> <TableColumnHeader>Warehouse</TableColumnHeader> <TableColumnHeader> Status <TableColumnActions> <TableSetFilter columnLabel="status" onValueChange={setStatus} options={STATUSES} value={status} /> </TableColumnActions> </TableColumnHeader> </TableRow> </TableHead> <TableBody> {rows.map((order) => ( <TableRow key={order.id} value={order.id}> <TableRowHeader text="nowrap">{order.id}</TableRowHeader> <TableCell>{order.customer}</TableCell> <TableCell>{order.warehouse}</TableCell> <TableCell>{order.status}</TableCell> </TableRow> ))} </TableBody> </TableContent> </Table> );}Selecting rows
selectionMode="multiple" with TableSelectAll in the header and TableSelect in each row gives every row a checkbox. Hold Shift and press a second checkbox to select the rows between the two. A disabled row cannot be selected and stays out of what the header checkbox covers. The selection is the list of row values, reported through onValueChange ([(value)] in Angular).
| Invoice | Customer | Status | Amount | |
|---|---|---|---|---|
| INV-2041 | Alfreds Futterkiste | Overdue | $1,240.00 | |
| INV-2042 | Great Lakes Food Market | Overdue | $18,402.75 | |
| INV-2043 | Hanari Carnes | Draft | $86.40 | |
| INV-2044 | Island Trading | Sent | $2,310.00 | |
| INV-2045 | Lonesome Pine Restaurant | Sent | $645.20 |
import { useState } from 'react';import { Table, TableBody, TableCell, TableColumnHeader, TableContent, TableFooter, TableHead, TableRow, TableRowHeader, TableSelect, TableSelectAll,} from '@slotted/react/table';import { Text } from '@slotted/react/typography';const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const INVOICES = [ { id: 'INV-2041', customer: 'Alfreds Futterkiste', status: 'Overdue', amount: 1240 }, { id: 'INV-2042', customer: 'Great Lakes Food Market', status: 'Overdue', amount: 18402.75 }, { id: 'INV-2043', customer: 'Hanari Carnes', status: 'Draft', amount: 86.4 }, { id: 'INV-2044', customer: 'Island Trading', status: 'Sent', amount: 2310 }, { id: 'INV-2045', customer: 'Lonesome Pine Restaurant', status: 'Sent', amount: 645.2 },];export default function TableSelection() { const [chosen, setChosen] = useState<readonly string[]>(['INV-2041']); const total = INVOICES.filter((invoice) => chosen.includes(invoice.id)).reduce( (sum, invoice) => sum + invoice.amount, 0, ); return ( <Table columns={5} onValueChange={setChosen} selectionMode="multiple" value={chosen}> <TableContent aria-label="Invoices to send reminders for"> <TableHead> <TableRow> <TableSelectAll /> <TableColumnHeader>Invoice</TableColumnHeader> <TableColumnHeader>Customer</TableColumnHeader> <TableColumnHeader>Status</TableColumnHeader> <TableColumnHeader numeric>Amount</TableColumnHeader> </TableRow> </TableHead> <TableBody> {INVOICES.map((invoice) => ( <TableRow disabled={invoice.status === 'Draft'} key={invoice.id} value={invoice.id}> <TableSelect /> <TableRowHeader text="nowrap">{invoice.id}</TableRowHeader> <TableCell>{invoice.customer}</TableCell> <TableCell>{invoice.status}</TableCell> <TableCell numeric>{USD.format(invoice.amount)}</TableCell> </TableRow> ))} </TableBody> </TableContent> <TableFooter> <Text size="sm" tone="muted"> {chosen.length} selected · {USD.format(total)} </Text> </TableFooter> </Table> );}Choosing one row
selectionMode="single" draws a radio in each row instead of a checkbox, for a choice among records such as a shipping rate. Leave the header cell above the radios empty.
| Carrier | Transit | Price | |
|---|---|---|---|
| UPS Ground | 3–5 days | $18.40 | |
| FedEx 2Day | 2 days | $31.15 | |
| USPS Priority | 1–3 days | $24.90 |
import { useState } from 'react';import { Table, TableBody, TableCell, TableColumnHeader, TableContent, TableHead, TableRow, TableRowHeader, TableSelect,} from '@slotted/react/table';const RATES = [ { id: 'ups-ground', carrier: 'UPS Ground', days: '3–5 days', price: '$18.40' }, { id: 'fedex-2day', carrier: 'FedEx 2Day', days: '2 days', price: '$31.15' }, { id: 'usps-priority', carrier: 'USPS Priority', days: '1–3 days', price: '$24.90' },];export default function TableSingleSelection() { const [rate, setRate] = useState<readonly string[]>(['ups-ground']); return ( <Table columns={4} onValueChange={setRate} selectionMode="single" value={rate}> <TableContent aria-label="Shipping rates for SO-10423"> <TableHead> <TableRow> <TableColumnHeader /> <TableColumnHeader>Carrier</TableColumnHeader> <TableColumnHeader>Transit</TableColumnHeader> <TableColumnHeader numeric>Price</TableColumnHeader> </TableRow> </TableHead> <TableBody> {RATES.map((option) => ( <TableRow key={option.id} value={option.id}> <TableSelect /> <TableRowHeader>{option.carrier}</TableRowHeader> <TableCell>{option.days}</TableCell> <TableCell numeric>{option.price}</TableCell> </TableRow> ))} </TableBody> </TableContent> </Table> );}Expandable rows
A TableExpander in a cell toggles the TableDetail row with the same value, which spans every column. The detail row is not rendered while it is closed. defaultExpanded opens rows on the first render; expanded with onExpandedChange ([(expanded)] in Angular) controls them.
| Return | Order | Customer | Refund | |
|---|---|---|---|---|
| RMA-0811 | SO-10398 | Ernst Handel | $214.50 | |
| Two cases of Chang arrived crushed. Carrier claim filed with UPS on Sep 24; refund issued to the original card. | ||||
| RMA-0812 | SO-10402 | QUICK-Stop | $58.00 | |
| RMA-0813 | SO-10407 | Hanari Carnes | $1,120.00 | |
import { Fragment } from 'react';import { Table, TableBody, TableCell, TableColumnHeader, TableContent, TableDetail, TableExpander, TableHead, TableRow, TableRowHeader,} from '@slotted/react/table';const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const RETURNS = [ { id: 'RMA-0811', order: 'SO-10398', customer: 'Ernst Handel', refund: 214.5, detail: 'Two cases of Chang arrived crushed. Carrier claim filed with UPS on Sep 24; refund issued to the original card.', }, { id: 'RMA-0812', order: 'SO-10402', customer: 'QUICK-Stop', refund: 58, detail: 'Wrong flavour shipped. Replacement sent from Columbus; the returned jar goes back to stock after inspection.', }, { id: 'RMA-0813', order: 'SO-10407', customer: 'Hanari Carnes', refund: 1120, detail: 'Order cancelled after dispatch. Pallet returned to Savannah unopened; restocking fee waived by account manager.', },];export default function TableExpansion() { return ( <Table columns={5} defaultExpanded={['RMA-0811']}> <TableContent aria-label="Returns"> <TableHead> <TableRow> <TableColumnHeader /> <TableColumnHeader>Return</TableColumnHeader> <TableColumnHeader>Order</TableColumnHeader> <TableColumnHeader>Customer</TableColumnHeader> <TableColumnHeader numeric>Refund</TableColumnHeader> </TableRow> </TableHead> <TableBody> {RETURNS.map((item) => ( <Fragment key={item.id}> <TableRow value={item.id}> <TableCell> <TableExpander /> </TableCell> <TableRowHeader text="nowrap">{item.id}</TableRowHeader> <TableCell>{item.order}</TableCell> <TableCell>{item.customer}</TableCell> <TableCell numeric>{USD.format(item.refund)}</TableCell> </TableRow> <TableDetail value={item.id}>{item.detail}</TableDetail> </Fragment> ))} </TableBody> </TableContent> </Table> );}Horizontal scroll
A table wider than its container scrolls inside its own region instead of widening the page. While it overflows, the region is named and takes a Tab stop, so a keyboard reader can scroll it with the arrow keys. sticky="start" on the first header and on each row header keeps the identifying column in view.
| Shipment | Order | Customer | Origin | Destination | Carrier | Shipped | Cost |
|---|---|---|---|---|---|---|---|
| SH-3301 | SO-10421 | Alfreds Futterkiste | Reno, NV | Berlin, DE | UPS Worldwide | Sep 28, 2026 | $412.80 |
| SH-3302 | SO-10422 | Bon app' | Columbus, OH | Marseille, FR | FedEx International | Sep 29, 2026 | $288.15 |
| SH-3303 | SO-10423 | Ernst Handel | Savannah, GA | Graz, AT | DHL Express | Sep 29, 2026 | $506.40 |
| SH-3304 | SO-10425 | QUICK-Stop | Columbus, OH | Cunewalde, DE | UPS Worldwide | Sep 30, 2026 | $347.90 |
import { Table, TableBody, TableCell, TableColumnHeader, TableContent, TableHead, TableRow, TableRowHeader,} from '@slotted/react/table';const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const SHIPMENTS = [ { id: 'SH-3301', order: 'SO-10421', customer: 'Alfreds Futterkiste', origin: 'Reno, NV', destination: 'Berlin, DE', carrier: 'UPS Worldwide', shipped: 'Sep 28, 2026', cost: 412.8, }, { id: 'SH-3302', order: 'SO-10422', customer: "Bon app'", origin: 'Columbus, OH', destination: 'Marseille, FR', carrier: 'FedEx International', shipped: 'Sep 29, 2026', cost: 288.15, }, { id: 'SH-3303', order: 'SO-10423', customer: 'Ernst Handel', origin: 'Savannah, GA', destination: 'Graz, AT', carrier: 'DHL Express', shipped: 'Sep 29, 2026', cost: 506.4, }, { id: 'SH-3304', order: 'SO-10425', customer: 'QUICK-Stop', origin: 'Columbus, OH', destination: 'Cunewalde, DE', carrier: 'UPS Worldwide', shipped: 'Sep 30, 2026', cost: 347.9, },];export default function TableScroll() { return ( <Table columns={8}> <TableContent aria-label="International shipments"> <TableHead> <TableRow> <TableColumnHeader sticky="start" text="nowrap"> Shipment </TableColumnHeader> <TableColumnHeader text="nowrap">Order</TableColumnHeader> <TableColumnHeader text="nowrap">Customer</TableColumnHeader> <TableColumnHeader text="nowrap">Origin</TableColumnHeader> <TableColumnHeader text="nowrap">Destination</TableColumnHeader> <TableColumnHeader text="nowrap">Carrier</TableColumnHeader> <TableColumnHeader text="nowrap">Shipped</TableColumnHeader> <TableColumnHeader numeric text="nowrap"> Cost </TableColumnHeader> </TableRow> </TableHead> <TableBody> {SHIPMENTS.map((shipment) => ( <TableRow key={shipment.id} value={shipment.id}> <TableRowHeader sticky="start" text="nowrap"> {shipment.id} </TableRowHeader> <TableCell text="nowrap">{shipment.order}</TableCell> <TableCell text="nowrap">{shipment.customer}</TableCell> <TableCell text="nowrap">{shipment.origin}</TableCell> <TableCell text="nowrap">{shipment.destination}</TableCell> <TableCell text="nowrap">{shipment.carrier}</TableCell> <TableCell text="nowrap">{shipment.shipped}</TableCell> <TableCell numeric>{USD.format(shipment.cost)}</TableCell> </TableRow> ))} </TableBody> </TableContent> </Table> );}Sticky header and totals
stickyHeader keeps the header row in view while the rows scroll, and stickyFooter does the same for a TableSummary (tfoot) of totals. With a height on the scroll region, the header sticks to the table’s own scroller, which is the form a drawer or a dialog needs; stickyTo="page" sticks it to the page instead.
| Order | Customer | Warehouse | Total |
|---|---|---|---|
| SO-10400 | Alfreds Futterkiste | Reno | $180.00 |
| SO-10401 | Bon app' | Columbus | $577.00 |
| SO-10402 | Ernst Handel | Savannah | $974.00 |
| SO-10403 | Folk och fä HB | Reno | $1,371.00 |
| SO-10404 | Hanari Carnes | Columbus | $1,768.00 |
| SO-10405 | Island Trading | Savannah | $2,165.00 |
| SO-10406 | QUICK-Stop | Reno | $2,562.00 |
| SO-10407 | Wartian Herkku | Columbus | $559.00 |
| SO-10408 | Alfreds Futterkiste | Savannah | $956.00 |
| SO-10409 | Bon app' | Reno | $1,353.00 |
| SO-10410 | Ernst Handel | Columbus | $1,750.00 |
| SO-10411 | Folk och fä HB | Savannah | $2,147.00 |
| SO-10412 | Hanari Carnes | Reno | $2,544.00 |
| SO-10413 | Island Trading | Columbus | $541.00 |
| SO-10414 | QUICK-Stop | Savannah | $938.00 |
| SO-10415 | Wartian Herkku | Reno | $1,335.00 |
| SO-10416 | Alfreds Futterkiste | Columbus | $1,732.00 |
| SO-10417 | Bon app' | Savannah | $2,129.00 |
| SO-10418 | Ernst Handel | Reno | $2,526.00 |
| SO-10419 | Folk och fä HB | Columbus | $523.00 |
| SO-10420 | Hanari Carnes | Savannah | $920.00 |
| SO-10421 | Island Trading | Reno | $1,317.00 |
| SO-10422 | QUICK-Stop | Columbus | $1,714.00 |
| SO-10423 | Wartian Herkku | Savannah | $2,111.00 |
| SO-10424 | Alfreds Futterkiste | Reno | $2,508.00 |
| SO-10425 | Bon app' | Columbus | $505.00 |
| SO-10426 | Ernst Handel | Savannah | $902.00 |
| SO-10427 | Folk och fä HB | Reno | $1,299.00 |
| SO-10428 | Hanari Carnes | Columbus | $1,696.00 |
| SO-10429 | Island Trading | Savannah | $2,093.00 |
| 30 orders | $43,695.00 | ||
import { Table, TableBody, TableCell, TableColumnHeader, TableContent, TableHead, TableRow, TableRowHeader, TableSummary,} from '@slotted/react/table';const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });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 ORDERS = Array.from({ length: 30 }, (_, index) => ({ id: `SO-${10400 + index}`, customer: CUSTOMERS[index % CUSTOMERS.length], warehouse: WAREHOUSES[index % WAREHOUSES.length], total: 180 + ((index * 397) % 2400),}));const TOTAL = ORDERS.reduce((sum, order) => sum + order.total, 0);export default function TableSticky() { return ( <Table columns={4} stickyFooter stickyHeader> <TableContent aria-label="September orders" scrollProps={{ style: { maxBlockSize: '20rem' } }} > <TableHead> <TableRow> <TableColumnHeader>Order</TableColumnHeader> <TableColumnHeader>Customer</TableColumnHeader> <TableColumnHeader>Warehouse</TableColumnHeader> <TableColumnHeader numeric>Total</TableColumnHeader> </TableRow> </TableHead> <TableBody> {ORDERS.map((order) => ( <TableRow key={order.id} value={order.id}> <TableRowHeader text="nowrap">{order.id}</TableRowHeader> <TableCell>{order.customer}</TableCell> <TableCell>{order.warehouse}</TableCell> <TableCell numeric>{USD.format(order.total)}</TableCell> </TableRow> ))} </TableBody> <TableSummary> <TableRow> <TableCell colSpan={3}>{ORDERS.length} orders</TableCell> <TableCell numeric>{USD.format(TOTAL)}</TableCell> </TableRow> </TableSummary> </TableContent> </Table> );}Pagination
TableFooter holds a bar under the table and inside its frame, where it does not scroll sideways with the columns. When the rows on screen are part of a larger set, totalRowCount on the content and rowIndex on each row tell assistive technology where the page sits in the whole.
| Invoice | Customer | Amount |
|---|---|---|
| INV-2041 | Alfreds Futterkiste | $120.00 |
| INV-2042 | Bon app' | $733.00 |
| INV-2043 | Ernst Handel | $1,346.00 |
| INV-2044 | Folk och fä HB | $1,959.00 |
| INV-2045 | Hanari Carnes | $2,572.00 |
import { useState } from 'react';import { Pagination, PaginationItems, PaginationNext, PaginationPrevious,} from '@slotted/react/pagination';import { Table, TableBody, TableCell, TableColumnHeader, TableContent, TableFooter, TableHead, TableRow, TableRowHeader,} from '@slotted/react/table';import { Text } from '@slotted/react/typography';const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop',];const INVOICES = Array.from({ length: 23 }, (_, index) => ({ id: `INV-${2041 + index}`, customer: CUSTOMERS[index % CUSTOMERS.length], amount: 120 + ((index * 613) % 3900),}));const PAGE_SIZE = 5;export default function TablePagination() { const [page, setPage] = useState(1); const first = (page - 1) * PAGE_SIZE; const rows = INVOICES.slice(first, first + PAGE_SIZE); return ( <Table columns={3}> <TableContent aria-label="Invoices" totalRowCount={INVOICES.length}> <TableHead> <TableRow> <TableColumnHeader>Invoice</TableColumnHeader> <TableColumnHeader>Customer</TableColumnHeader> <TableColumnHeader numeric>Amount</TableColumnHeader> </TableRow> </TableHead> <TableBody> {rows.map((invoice, index) => ( <TableRow key={invoice.id} rowIndex={first + index + 1} value={invoice.id}> <TableRowHeader text="nowrap">{invoice.id}</TableRowHeader> <TableCell>{invoice.customer}</TableCell> <TableCell numeric>{USD.format(invoice.amount)}</TableCell> </TableRow> ))} </TableBody> </TableContent> <TableFooter> <Text size="sm" tone="muted"> {first + 1}–{first + rows.length} of {INVOICES.length} </Text> <Pagination count={INVOICES.length} onPageChange={setPage} page={page} pageSize={PAGE_SIZE}> <PaginationPrevious /> <PaginationItems /> <PaginationNext /> </Pagination> </TableFooter> </Table> );}First load
TableLoader draws skeleton rows in place of the body while the first rows load, so the page does not jump when they arrive. The skeleton rows are hidden from assistive technology.
| Purchase order | Supplier | Expected | Value |
|---|---|---|---|
import { Table, TableColumnHeader, TableContent, TableHead, TableLoader, TableRow,} from '@slotted/react/table';export default function TableLoading() { return ( <Table columns={4}> <TableContent aria-label="Purchase orders"> <TableHead> <TableRow> <TableColumnHeader>Purchase order</TableColumnHeader> <TableColumnHeader>Supplier</TableColumnHeader> <TableColumnHeader>Expected</TableColumnHeader> <TableColumnHeader numeric>Value</TableColumnHeader> </TableRow> </TableHead> <TableLoader skeletonRows={4} /> </TableContent> </Table> );}Refreshing
loading on a table that already shows rows dims the body and sets aria-busy, so every column keeps its width and the reader keeps their place while the new rows load. Press Refresh to see it.
| Purchase order | Supplier | Expected | Value |
|---|---|---|---|
| PO-7710 | Exotic Liquids | Oct 3 | $4,120.00 |
| PO-7711 | Tokyo Traders | Oct 6 | $2,875.50 |
| PO-7712 | Pavlova, Ltd. | Oct 8 | $9,310.00 |
import { useEffect, useState } from 'react';import { Button } from '@slotted/react/button';import { Stack } from '@slotted/react/stack';import { Table, TableBody, TableCell, TableColumnHeader, TableContent, TableHead, TableRow, TableRowHeader,} from '@slotted/react/table';const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const PURCHASE_ORDERS = [ { id: 'PO-7710', supplier: 'Exotic Liquids', expected: 'Oct 3', value: 4120 }, { id: 'PO-7711', supplier: 'Tokyo Traders', expected: 'Oct 6', value: 2875.5 }, { id: 'PO-7712', supplier: 'Pavlova, Ltd.', expected: 'Oct 8', value: 9310 },];export default function TableRefreshing() { const [loading, setLoading] = useState(false); useEffect(() => { if (!loading) return; const timer = setTimeout(() => setLoading(false), 1500); return () => clearTimeout(timer); }, [loading]); return ( <Stack align="start" gap={3}> <Button loading={loading} onClick={() => setLoading(true)} size="sm" variant="outline"> Refresh </Button> <Table columns={4} loading={loading}> <TableContent aria-label="Purchase orders"> <TableHead> <TableRow> <TableColumnHeader>Purchase order</TableColumnHeader> <TableColumnHeader>Supplier</TableColumnHeader> <TableColumnHeader>Expected</TableColumnHeader> <TableColumnHeader numeric>Value</TableColumnHeader> </TableRow> </TableHead> <TableBody> {PURCHASE_ORDERS.map((order) => ( <TableRow key={order.id} value={order.id}> <TableRowHeader text="nowrap">{order.id}</TableRowHeader> <TableCell>{order.supplier}</TableCell> <TableCell>{order.expected}</TableCell> <TableCell numeric>{USD.format(order.value)}</TableCell> </TableRow> ))} </TableBody> </TableContent> </Table> </Stack> );}Empty
TableEmpty is one cell that spans every column, in a row of its own: the React part writes the row, and Angular’s td[slTableEmpty] goes inside a tr. Put a result state in it: status="empty" for a set with nothing in it yet, status="no-results" for a set a filter emptied.
| Return | Order | Customer | Refund |
|---|---|---|---|
No returns this week Returns appear here as soon as a customer opens one from their order page. | |||
import { ResultState, ResultStateContent, ResultStateDescription, ResultStateTitle,} from '@slotted/react/result-state';import { Table, TableBody, TableColumnHeader, TableContent, TableEmpty, TableHead, TableRow,} from '@slotted/react/table';export default function TableEmptyExample() { return ( <Table columns={4}> <TableContent aria-label="Returns this week"> <TableHead> <TableRow> <TableColumnHeader>Return</TableColumnHeader> <TableColumnHeader>Order</TableColumnHeader> <TableColumnHeader>Customer</TableColumnHeader> <TableColumnHeader numeric>Refund</TableColumnHeader> </TableRow> </TableHead> <TableBody> <TableEmpty> <ResultState status="empty"> <ResultStateContent> <ResultStateTitle>No returns this week</ResultStateTitle> <ResultStateDescription> Returns appear here as soon as a customer opens one from their order page. </ResultStateDescription> </ResultStateContent> </ResultState> </TableEmpty> </TableBody> </TableContent> </Table> );}Rich cells
A cell holds any content: a link to the record, an avatar beside a name, a status indicator. Put the link in the row header, so the record’s name is the link a reader follows.
| Account | Account manager | ERP sync | Balance |
|---|---|---|---|
| Alfreds Futterkiste | NDNancy Davolio | In sync | $1,240.00 |
| Ernst Handel | AFAndrew Fuller | Delayed | $3,410.25 |
| QUICK-Stop | JLJanet Leverling | Failed | $2,088.90 |
import { Avatar } from '@slotted/react/avatar';import { Inline } from '@slotted/react/inline';import { Link } from '@slotted/react/link';import { StatusIndicator } from '@slotted/react/status-indicator';import { Table, TableBody, TableCell, TableColumnHeader, TableContent, TableHead, TableRow, TableRowHeader,} from '@slotted/react/table';const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const ACCOUNTS = [ { id: 'ALFKI', name: 'Alfreds Futterkiste', manager: 'Nancy Davolio', sync: 'success', syncLabel: 'In sync', balance: 1240, }, { id: 'ERNSH', name: 'Ernst Handel', manager: 'Andrew Fuller', sync: 'warning', syncLabel: 'Delayed', balance: 3410.25, }, { id: 'QUICK', name: 'QUICK-Stop', manager: 'Janet Leverling', sync: 'danger', syncLabel: 'Failed', balance: 2088.9, },] as const;export default function TableContentExample() { return ( <Table columns={4}> <TableContent aria-label="Key accounts"> <TableHead> <TableRow> <TableColumnHeader>Account</TableColumnHeader> <TableColumnHeader>Account manager</TableColumnHeader> <TableColumnHeader>ERP sync</TableColumnHeader> <TableColumnHeader numeric>Balance</TableColumnHeader> </TableRow> </TableHead> <TableBody> {ACCOUNTS.map((account) => ( <TableRow key={account.id} value={account.id}> <TableRowHeader text="nowrap"> <Link href={`#${account.id}`}>{account.name}</Link> </TableRowHeader> <TableCell text="nowrap"> <Inline align="center" gap={2}> <Avatar name={account.manager} size="sm" /> {account.manager} </Inline> </TableCell> <TableCell text="nowrap"> <StatusIndicator status={account.sync}>{account.syncLabel}</StatusIndicator> </TableCell> <TableCell numeric>{USD.format(account.balance)}</TableCell> </TableRow> ))} </TableBody> </TableContent> </Table> );}Editing in place
A control with variant="plain" and size="sm" takes the cell’s own padding and the row’s height, so a row does not grow when it becomes editable. Give each control a label that names its row, because the column header alone does not say which record it edits.
| SKU | Product | Counted | Bin |
|---|---|---|---|
| PRD-0412 | Chai | ||
| PRD-0413 | Chang | ||
| PRD-0414 | Aniseed Syrup | ||
| PRD-0415 | Chef Anton's Cajun Seasoning |
import { useState } from 'react';import { NumberField } from '@slotted/react/number-field';import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue,} from '@slotted/react/select';import { Table, TableBody, TableCell, TableColumnHeader, TableContent, TableHead, TableRow, TableRowHeader,} from '@slotted/react/table';const BINS = ['A-04', 'A-07', 'B-12', 'C-01'];const STOCK = [ { sku: 'PRD-0412', product: 'Chai', counted: 390, bin: 'A-04' }, { sku: 'PRD-0413', product: 'Chang', counted: 170, bin: 'A-04' }, { sku: 'PRD-0414', product: 'Aniseed Syrup', counted: 130, bin: 'B-12' }, { sku: 'PRD-0415', product: "Chef Anton's Cajun Seasoning", counted: 53, bin: 'C-01' },];type Line = (typeof STOCK)[number];export default function TableEditing() { const [lines, setLines] = useState<readonly Line[]>(STOCK); const update = (sku: string, change: Partial<Line>) => setLines((current) => current.map((line) => (line.sku === sku ? { ...line, ...change } : line)), ); return ( <Table columns={4}> <TableContent aria-label="Stock take, Reno"> <TableHead> <TableRow> <TableColumnHeader>SKU</TableColumnHeader> <TableColumnHeader>Product</TableColumnHeader> <TableColumnHeader numeric>Counted</TableColumnHeader> <TableColumnHeader>Bin</TableColumnHeader> </TableRow> </TableHead> <TableBody> {lines.map((line) => ( <TableRow key={line.sku} value={line.sku}> <TableRowHeader text="nowrap">{line.sku}</TableRowHeader> <TableCell>{line.product}</TableCell> <TableCell numeric> <NumberField aria-label={`Counted for ${line.sku}`} min={0} onValueChange={(value) => update(line.sku, { counted: value ?? 0 })} size="sm" stepper="none" value={line.counted} variant="plain" /> </TableCell> <TableCell> <Select onValueChange={(value) => update(line.sku, { bin: value as string })} size="sm" value={line.bin} variant="plain" > <SelectTrigger aria-label={`Bin of ${line.sku}`}> <SelectValue /> </SelectTrigger> <SelectContent> {BINS.map((bin) => ( <SelectItem key={bin} value={bin}> {bin} </SelectItem> ))} </SelectContent> </Select> </TableCell> </TableRow> ))} </TableBody> </TableContent> </Table> );}Recipe: orders list
A listing screen composes the parts above: sortable columns, a status filter that returns to the first page, row selection with a bulk action in the footer, and pagination over the filtered set.
| Status | ||||
|---|---|---|---|---|
| SO-10440 | Island Trading | Processing | $1,767.00 | |
| SO-10439 | Hanari Carnes | Delivered | $1,034.00 | |
| SO-10438 | Folk och fä HB | On hold | $301.00 | |
| SO-10437 | Ernst Handel | Shipped | $3,668.00 | |
| SO-10436 | Bon app' | Processing | $2,935.00 | |
| SO-10435 | Alfreds Futterkiste | Processing | $2,202.00 |
import { useMemo, useState } from 'react';import { createFilterPredicate, type SetFilter } from '@slotted/core/filter';import { Button } from '@slotted/react/button';import { Inline } from '@slotted/react/inline';import { Pagination, PaginationItems, PaginationNext, PaginationPrevious,} from '@slotted/react/pagination';import { Table, TableBody, TableCell, TableColumnActions, TableColumnHeader, TableContent, TableFooter, TableHead, TableRow, TableRowHeader, TableSelect, TableSelectAll, TableSetFilter, TableSort, type TableSortDescriptor,} from '@slotted/react/table';import { Text } from '@slotted/react/typography';const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });const CUSTOMERS = [ 'Alfreds Futterkiste', "Bon app'", 'Ernst Handel', 'Folk och fä HB', 'Hanari Carnes', 'Island Trading', 'QUICK-Stop',];const STATUS_CYCLE = ['Processing', 'Shipped', 'On hold', 'Delivered', 'Processing'];const ORDERS = Array.from({ length: 20 }, (_, index) => ({ id: `SO-${10421 + index}`, customer: CUSTOMERS[index % CUSTOMERS.length], status: STATUS_CYCLE[index % STATUS_CYCLE.length], total: 140 + ((index * 733) % 4100),}));type Order = (typeof ORDERS)[number];const STATUSES = ['Processing', 'On hold', 'Shipped', 'Delivered'].map((value) => ({ value, count: ORDERS.filter((order) => order.status === value).length,}));const PAGE_SIZE = 6;function sortOrders(rows: readonly Order[], sort: TableSortDescriptor | null): readonly Order[] { if (sort === null) return rows; const key = sort.column as keyof Order; const sign = sort.direction === 'ascending' ? 1 : -1; return [...rows].sort((a, b) => typeof a[key] === 'number' ? ((a[key] as number) - (b[key] as number)) * sign : String(a[key]).localeCompare(String(b[key])) * sign, );}export default function TableOrdersList() { const [sort, setSort] = useState<TableSortDescriptor | null>({ column: 'id', direction: 'descending', }); const [status, setStatus] = useState<SetFilter | null>(null); const [chosen, setChosen] = useState<readonly string[]>([]); const [page, setPage] = useState(1); const matching = useMemo(() => { const keep = createFilterPredicate(status); return sortOrders( ORDERS.filter((order) => keep(order.status)), sort, ); }, [sort, status]); const first = (page - 1) * PAGE_SIZE; const rows = matching.slice(first, first + PAGE_SIZE); return ( <Table columns={5} onSortChange={setSort} onValueChange={setChosen} selectionMode="multiple" sort={sort} value={chosen} > <TableContent aria-label="Orders" totalRowCount={matching.length}> <TableHead> <TableRow> <TableSelectAll /> <TableColumnHeader column="id"> <TableSort>Order</TableSort> </TableColumnHeader> <TableColumnHeader column="customer"> <TableSort>Customer</TableSort> </TableColumnHeader> <TableColumnHeader> Status <TableColumnActions> <TableSetFilter columnLabel="status" onValueChange={(next) => { setStatus(next); setPage(1); }} options={STATUSES} value={status} /> </TableColumnActions> </TableColumnHeader> <TableColumnHeader column="total" numeric> <TableSort>Total</TableSort> </TableColumnHeader> </TableRow> </TableHead> <TableBody> {rows.map((order, index) => ( <TableRow key={order.id} rowIndex={first + index + 1} value={order.id}> <TableSelect /> <TableRowHeader text="nowrap">{order.id}</TableRowHeader> <TableCell>{order.customer}</TableCell> <TableCell>{order.status}</TableCell> <TableCell numeric>{USD.format(order.total)}</TableCell> </TableRow> ))} </TableBody> </TableContent> <TableFooter> <Inline align="center" gap={3}> <Text size="sm" tone="muted"> {chosen.length} selected </Text> <Button disabled={chosen.length === 0} size="sm" variant="outline"> Print packing slips </Button> </Inline> <Pagination count={matching.length} onPageChange={setPage} page={page} pageSize={PAGE_SIZE}> <PaginationPrevious /> <PaginationItems /> <PaginationNext /> </Pagination> </TableFooter> </Table> );}Accessibility
| Key | Effect | Focus |
|---|---|---|
| Tab | moves to the next control the table holds: the scroll region while it overflows, then each sort button, selection checkbox, expander and consumer control in DOM order | that control |
| Shift+Tab | the same, backwards | the previous control |
| Enter | activates the focused button: sorts the column, or opens and closes a row's detail | stays on the control |
| Space | activates the focused button; on a row's checkbox it changes that row's selection | stays on the control |
| Shift+Space | on a row's checkbox, selects every row from the anchor to that one | stays on the control |
| ArrowDown | scrolls the region while it holds focus | stays on the region |
| ArrowUp | the same, backwards | stays on the region |
| ArrowRight | scrolls along the inline axis, mirrored in a right-to-left document | stays on the region |
| ArrowLeft | the mirror of ArrowRight | stays on the region |
| PageDown | scrolls the region by a view | stays on the region |
| PageUp | scrolls the region back by a view | stays on the region |
| Home | scrolls the region to its start | stays on the region |
| End | scrolls the region to its end | stays on the region |
| Enter | applies the draft and closes the panel, which is what a reader who has just typed a value expects and what AG Grid does | returns to the filter trigger, which popover restores it to |
- The role is table and not grid, and the difference is the whole boundary with data-grid. The APG says a table "is not an interactive widget. Thus, its cells are not focusable or selectable", so every control inside is its own tab stop and the family binds no key. Column resizing, virtualisation, multi-column sort and row activation all need the grid pattern and are deferred to the family that has it.
- Every role comes from the platform: table, thead, tbody, tfoot, tr, th and td already carry table, rowgroup, row, columnheader, rowheader and cell. The family writes none of them, and it writes no aria-labelledby either — a caption is the accessible name by the browser own rule, whether it is visible or visually hidden.
- scope="col" on a column header and scope="row" on a row header are what make a screen reader repeat the column name and the record name in each cell. They are the two attributes §12 of the feature guide asks for by name.
- aria-sort is written on the sorted header and removed from every other, because ARIA has no way to state a sort level and a second sorted column would be silent or a lie. The change is also announced politely with the column and the direction: a property that changes silently is a change no reader hears, and none of the six surveyed implementations says it.
- A row is not selectable under this role, so it carries no aria-selected. The state is painted with data-selected and announced by the checkbox that owns it — the division list-item recorded — and the header checkbox states in its own name how many rows it covers.
- aria-rowcount and aria-rowindex are written exactly when you state a total larger than the DOM, which is what the Grid and Table Properties practice requires: the pair exists to say the DOM is not the whole set. The practice warns that writing aria-rowindex on some rows and not others has devastating effects, so the family writes neither unless you state both.
- The scroller becomes a region with a tab stop and a name only while the table overflows, measured rather than assumed. A wide table with no tab stop is unreachable without a pointer — a WCAG 2.2 level A failure — and a tab stop on a table that fits is one a reader presses for nothing.
- The expander is the Disclosure pattern: a button with aria-expanded, and with aria-controls naming the detail row while it is open. A closed detail is not rendered at all, so nothing is announced that a reader cannot reach.
- A selected row is said by its ground and its ink together, and by the checkbox mark. R1 of this repository forbids the rail two families reached for, and in the high-contrast scheme every tone ground is the page own white — so the mark is what survives, which is where WCAG 2.2 SC 1.4.1 puts the requirement.
API
Table
Props
sortTableSortDescriptor | null- The column the rows are ordered by. Present means you own it.
defaultSortTableSortDescriptor | nullDefaultnull- The order an uncontrolled table starts in, read once
valuereadonly string[]- The chosen rows. Present means you own the selection.
defaultValuereadonly string[]Default[]- The rows an uncontrolled table starts with
expandedreadonly string[]- The rows whose detail is open. Present means you own it.
defaultExpandedreadonly string[]Default[]- The details an uncontrolled table starts with
variant'plain' | 'ruled' | 'framed'Defaultruled- How much of a frame the set is given
edges'inset' | 'flush'Defaultinset- Whether the first and the last column keep the cell inset on their outer side. flush lines a plain or ruled table up with the heading around it, leaving the theme’s --slotted-table-edge-inset (0 unless set); a framed table ignores it. Sticky and selection columns keep their own offsets
stripedbooleanDefaultfalse- A tinted ground on every second record
guidesboolean | 'branch'Defaulttrue- A line per ancestor level beside the rows that name a parent, on the center of the expander one level up. branch draws a rail from the foot of the parent’s mark (TableMark, or the expander), a branch to each child and an elbow at the last, and keeps the marks of a level in one column
expanderRoom'auto' | 'always'Defaultauto- Under guides="branch", whether the marks of the top level keep the room of an expander before them. auto keeps it while a row of the table has one; always keeps it in a table where no row folds, so the marks of several tables, and of a table and its skeleton, stand in one column
stickyHeaderbooleanDefaultfalse- Whether the header stays while the body scrolls
stickyFooterbooleanDefaultfalse- Whether the summary rows stay while the body scrolls. It pins the tfoot and not the footer bar, which never scrolls.
stickyTo'scroll' | 'page'Defaultscroll- What the header stays inside: this table own scroller, or whatever scrolls outside it. page releases the scroller, so the table stops scrolling sideways in its frame.
optionsreadonly TableFilterOption[]Default[]- On TableSetFilterThe values the column can be filtered to, each with an optional count of its own. With operand tags they are a datalist and the set a typed value must belong to; without them any value is admitted.
operand'list' | 'tags'Defaultlist- On TableSetFilterHow the values are chosen: the search, the covering checkbox and the list, or tags-input holding the chosen values as chips. The descriptor is the same list either way.
presetsreadonly PickerPreset[]- On TableDateFilter, TableTimeFilter, TableDateTimeFilterThe application’s own ranges, each a label and a run, offered inside the range picker between draws. The descriptor still receives two ISO values.
granularity'hour' | 'minute' | 'second'Defaultminute- On TableTimeFilter, TableDateTimeFilterThe last unit the picker writes, and the precision the engine compares at: a minute-precision operand matches every second of its minute.
valueTextFilter | NumberFilter | DateFilter | TimeFilter | DateTimeFilter | BooleanFilter | SetFilter | nullDefaultnull- On Table*FilterThe descriptor the column is filtered by, typed as its own kind. Controlled when stated; defaultValue is the uncontrolled form, and onValueChange fires once, on Apply.
operatorsreadonly FilterOperator[]Default the kind own list- On Table*FilterNarrows what the chooser offers, in the order given. defaultOperator picks the one the panel opens on.
conditions1 | 2Default2- On Table*FilterHow many conditions the panel offers. The second appears once the first is complete.
renderOperand(props: TableFilterOperandProps) => ReactNode- On Table*FilterReplaces the field the table would have drawn, and keeps the draft, the chooser, the join, the actions and the announcements.
searchThresholdnumberDefault8- On TableSetFilterHow many values bring a search with them. searchable states it outright.
cellAlign'start' | 'center' | 'end'Defaultcenter- Where every cell content sits in a row as tall as its tallest cell. A cell states blockAlign to answer differently.
layout'auto' | 'fixed'Defaultauto- Whether the browser sizes the columns from their content or from what you state
selectionMode'none' | 'single' | 'multiple'Defaultnone- How many records may be chosen at once
columnsnumberDefault1- How many columns the spanning parts span
loadingbooleanDefaultfalse- A refresh over rows already shown: aria-busy, and nothing moves
messagesPartial<TableMessages>- Words laid over the language in force, key by key: selection, expansion, sort and every word of the column filters
skeletonRowsnumberDefault5- On TableLoaderHow many skeleton rows a first load draws
totalRowCountnumber- On TableContentThe size of the set behind a page, written as aria-rowcount
scrollLabelledBystring- On TableContentThe element that names the region instead, usually the caption
valuestring- On TableRowThe record key the selection and the expansion are held by
levelnumber- On TableRowHow deep the row sits under the rows that fold it, from 0. The first cell that is not the selection is indented by this many steps, and a cell without an expander keeps its box as space
parentstring- On TableRowThe value of the row whose expander folds this one. The row is not rendered while that row, or any row above it, is closed.
disabledbooleanDefaultfalse- On TableRowA record the reader may not choose; it leaves the set the header covers
rowIndexnumber- On TableRowThe record position in the whole set, written as aria-rowindex
currentbooleanDefaultfalse- On TableRowThe record open elsewhere on the page, a detail pane beside the table, written as aria-current
visuallyHiddenbooleanDefaultfalse- On TableCaptionKeeps the caption as the accessible name of the table and draws nothing, for a table under a heading that already names it
mutedbooleanDefaultfalse- On TableRowDraws the row in the muted ink, for a record that is no longer active; the row stays selectable and pressable
interactivebooleanDefault true with onAction- On TableRowPaints the row as a thing the pointer presses
onAction(event) => void- On TableRowA click anywhere in the row that lands on no control of its own; the first link or button in the row is the keyboard way in
endReactNode- On TableGroupRowWhat stands at the end of the band: the total or net of the group
columnstring- On TableColumnHeader, TableSortThe column key the sort descriptor names
align'start' | 'center' | 'end'Defaultstart- On the three cell partsWhich edge the value stands on, resolved logically
numericbooleanDefaultfalse- On the three cell partsTabular figures, and the end edge unless align says otherwise
blockAlign'start' | 'center' | 'end'Defaultcenter- On the three cell parts and both selection cellsWhere this cell content sits in its row, overriding the table own cellAlign
text'wrap' | 'truncate' | 'nowrap'Defaultwrap- On the three cell partsWhat a value longer than its column does
sticky'start' | 'end'Defaultstart- On the three cell parts and both selection cellsWhich edge the column is pinned to while the table scrolls past it
stickybooleanDefaultfalse- On TableGroupRowHolds the band under the header while its rows scroll past
stickyOffsetstringDefault0- On the three cell parts and both selection cellsWhere the pinned column stops, as a CSS length. Two columns pinned to the same edge need the second to state how wide the first is — beside a selection column that is --slotted-table-selection-size, which is 3rem.
colSpannumber- On TableDetail, TableEmptyHow many columns the part spans, defaulting to the table own count
Events
| Name | Payload | When |
|---|---|---|
onSortChange | (value: TableSortDescriptor | null, request) | The column and the direction the reader asked for, or null when the third press clears it. The request carries the reason — pointer, keyboard, clear or programmatic — and cancel(). |
onValueChange | (value: readonly string[], request) | The chosen rows, in the collection order rather than the order they were pressed. The reason is select for a range or a select-all, clear when the set is emptied, pointer otherwise. |
onExpandedChange | (value: readonly string[], request) | The rows whose detail is open, after the press that opened or closed one. |
Composition
render(props) => ReactNode- On Table, TableRow, TableSortSubstitutes the rendered element, keeping every data attribute
refRef<HTMLElement>- On every partReaches the element, and focus() with it
handleRefRefObject<TableHandle>- On TableContentscrollToRow(), overflowing() and refresh(): the three a prop cannot express
useTable()() => TableContextValue- On inside a TableThe sort, the selection and the words, for a part of your own
TableDefaultsProvidervariant | striped | stickyHeader | stickyFooter | stickyTo | layout | selectionMode | columns- On ApplicationSets those once for everything below it; a prop on the table still wins
scrollPropsComponentPropsWithRef<'div'>- On TableContentReaches the scroller: a height, a ref, a scroll listener of your own
Parts
| Part | Element | Required | Purpose |
|---|---|---|---|
root | div | Yes | The frame. It carries every axis, and it holds what must not move when the table is scrolled sideways: the border, the radius and the footer bar. |
scroll | div | Yes | The scroller, and the element a sticky header resolves against. It becomes a named region with a tab stop only while the table overflows. |
table | table | Yes | The tabular structure itself, and the element the platform gives the role to. It carries aria-rowcount when the DOM holds a page of a larger set. |
caption | caption | No | The table name, and the accessible name whether it is read or hidden. The family writes no aria-labelledby restating what the browser already states. |
head | thead | No | The header row group. It sticks to the scroller when stickyHeader is on. |
body | tbody | Yes | The rows. A table may hold more than one, which is how a set is grouped by section. |
summary | tfoot | No | The column summaries, which is the HTML Standard own word for a tfoot: a total, a count, a unit. It is not the footer bar. |
footer | div | No | The bar under the table and inside the frame, where a paged listing puts its control. It is a sibling of the scroller, so a table scrolled sideways does not take its pagination with it. |
row | tr | Yes | One record. It carries data-selected and data-expanded for the stylesheet and data-value for the range and the select-all. |
column-header | th | No | A column name, scoped to its column. It carries aria-sort when it is the sorted one, and on no other header. A name its box cuts — text="truncate" on a column with no room — opens a hint with the whole of it, shown rather than read, because the header already states the words. |
row-header | th | No | The cell that identifies the record, scoped to its row, which a screen reader repeats in each cell beside it. |
cell | td | Yes | One value, and the four axes a cell answers: align, numeric, text and sticky. |
sort | button | No | The column name wrapped in a button, which is what the APG sortable example does. The whole header is the target. |
column-actions | span | No | The slot beside a column name for the controls it carries: a filter trigger, a column menu, a help hint. The family holds the place; the query is yours. |
filter | button | No | The trigger the table draws in that slot, and everything behind it. It marks itself while the column is filtered and states what is applied in its own name. |
filter-panel | div | No | The surface the trigger opens: the conditions, the join between them and the two actions. It edits a draft — nothing reaches you until Apply. |
filter-condition | div | No | One condition: an operator and the operands that operator takes. Two of them at most, and the second appears once the first is complete. |
filter-operator | div | No | The chooser, which is the Select family. What it offers is the kind own list, narrowed by operators. |
filter-operand | div | No | The field the operator asks for: none for is empty, one for a comparison, two for between. renderOperand replaces it and keeps everything else. |
filter-join | div | No | And or Or between two conditions, which is also the word between the ends of a range. |
filter-search | div | No | The field that narrows a set filter values, through the same locale collator Combobox filters with. It appears once there are searchThreshold values. |
filter-list | div | No | The values, scrolling inside the panel rather than making the panel taller than the screen. |
filter-option | div | No | One value, its checkbox and its count. The first is the covering checkbox, which answers for exactly what the search left. |
filter-empty | p | No | The word shown when the search matches nothing, so the panel is never a blank box. |
filter-actions | div | No | The footer: Clear at the leading edge and Apply at the trailing one. |
selection | th or td | No | The cell holding the checkbox, in the header and in every row. The cell is this family and the chooser is Checkbox. |
expander | button | No | Opens and closes one row detail. It carries aria-expanded, and aria-controls naming the detail row while that row is open. It is the APG Disclosure pattern, borrowed whole. |
mark | span | No | A record’s leading mark: an avatar, a logo, an icon. One box per level, --slotted-table-mark-size and a step smaller at a child, which the steps of an avatar up to md measure. Under guides="branch" the rail of the children starts at its foot. |
detail | tr | No | The open row detail, one cell spanning every column. It is not rendered while it is closed. |
group-row | tr | No | The band that opens a group of rows: a day of a ledger with its net at the end. One header cell spans every column, and sticky holds the band under the header while its rows scroll past. |
group-header | th | No | The one cell of the band, scope="rowgroup", spanning the columns of the table. It names the rows of its own tbody, so a grouped listing writes one body per group. |
group-content | div | No | The line inside the band that sets the name at the start and the end content at the end. |
group-start | span | No | The name of the group. |
group-end | span | No | The end of the band, from the end prop: the total or net of the group, in tabular figures. |
empty | td | No | What is shown when there is nothing, spanning every column, in a row the part writes itself. It takes a ResultState, which already separates an empty set from a set a filter emptied. |
loader | tbody | No | The skeleton rows of a first load: the table shape before its content. A refresh over rows already read is the other state and dims the body instead. |
Theming
Each token is a CSS custom property: set it in a theme, or on any element to retune every table inside it.
Table tokens
| Token | Default |
|---|---|
--slotted-table-border-color | var(--slotted-border-subtle, ButtonBorder) |
--slotted-table-border-color-strong | var(--slotted-border-strong, ButtonBorder) |
--slotted-table-border-width | var(--slotted-border-width-thin, 1px) |
--slotted-table-branch-size | 1.25rem |
--slotted-table-caption-surface | var(--_head-surface) |
--slotted-table-cell-padding-block | max( var(--slotted-space-2, 0.25rem), calc((var(--_row-min-block) - var(--_font-size) * var(--slotted-line-height-md, 1.5)) / 2) ) |
--slotted-table-cell-padding-inline | var(--slotted-control-padding-inline-md, 13px) |
--slotted-table-color | var(--slotted-text, CanvasText) |
--slotted-table-color-muted | var(--slotted-text-muted, GrayText) |
--slotted-table-column-actions-size | calc(var(--_pad-inline) + var(--slotted-target-min, 24px) + var(--_gap)) |
--slotted-table-control-radius | var(--slotted-radius-sm, 4px) |
--slotted-table-edge-inset | 0px |
--slotted-table-font-family | var(--slotted-control-font-family) |
--slotted-table-font-size | var(--slotted-control-font-size-md, 13px) |
--slotted-table-gap | var(--slotted-control-gap-md, 8px) |
--slotted-table-group-color | var(--_text) |
--slotted-table-group-sticky-offset | 0 |
--slotted-table-group-surface | var(--_stripe) |
--slotted-table-guide-color | color-mix(in oklab, var(--slotted-border-strong) 60%, var(--slotted-border-subtle)) |
--slotted-table-header-backdrop-filter | none |
--slotted-table-header-surface | color-mix(in oklab, var(--slotted-text, CanvasText) 8%, var(--_surface)) |
--slotted-table-header-surface-hover | color-mix(in oklab, var(--slotted-text, CanvasText) 7%, var(--_head-surface)) |
--slotted-table-icon-size | var(--slotted-control-icon-size-md, 16px) |
--slotted-table-mark-child-size | 1.25rem |
--slotted-table-mark-size | 1.5rem |
--slotted-table-radius | var(--slotted-radius-md, 6px) |
--slotted-table-row-color-selected | var(--slotted-tone-accent-text, CanvasText) |
--slotted-table-row-min-block-size | var(--slotted-control-height-md, 34px) |
--slotted-table-row-surface-current | var(--slotted-tone-secondary-subtle-active, ButtonFace) |
--slotted-table-row-surface-hover | var(--slotted-tone-secondary-subtle-hover, ButtonFace) |
--slotted-table-row-surface-selected | var(--slotted-tone-accent-surface, Canvas) |
--slotted-table-row-surface-selected-hover | var(--slotted-tone-accent-subtle-hover, ButtonFace) |
--slotted-table-row-surface-stripe | color-mix(in oklab, var(--slotted-text, CanvasText) 5%, var(--_surface)) |
--slotted-table-selection-size | 3rem |
--slotted-table-shadow | var(--slotted-shadow-xs, none) |
--slotted-table-sticky-inset | 0 |
--slotted-table-sticky-offset | 0 |
--slotted-table-sticky-offset-end | 0 |
--slotted-table-sticky-surface | var(--slotted-ground, var(--slotted-surface, Canvas)) |
--slotted-table-surface | var(--slotted-ground, var(--slotted-surface, Canvas)) |
--slotted-table-tree-indent | calc(var(--slotted-target-min, 24px) / 2 + var(--slotted-space-4, 0.5rem)) |
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-thin | 1px |
--slotted-control-font-family | var(--slotted-font-family-sans) |
--slotted-control-font-size-md | comfortable 13px · compact 12px · dense 12px |
--slotted-control-gap-md | comfortable 8px · compact 6px · dense 4px |
--slotted-control-height-md | comfortable 34px · compact 28px · dense 26px |
--slotted-control-icon-size-md | comfortable 16px · compact 14px · dense 13px |
--slotted-control-padding-inline-md | comfortable 13px · compact 10px · dense 8px |
--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-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-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-radius-md | 6px |
--slotted-radius-sm | 4px |
--slotted-shadow-xs | Set per scheme by the theme |
--slotted-space-1 | 0.125rem |
--slotted-space-2 | 0.25rem |
--slotted-space-4 | 0.5rem |
--slotted-space-5 | 0.75rem |
--slotted-space-9 | 2rem |
--slotted-surface | 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-subtle-hover | 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-secondary-subtle-active | Set per scheme by the theme |
--slotted-tone-secondary-subtle-hover | Set per scheme by the theme |
--slotted-z-index-sticky | 100 |