Table
A controlled, column/data-driven data table. Table owns sort, selection, and search-filtering state; TableHeader, TableBody, and TableFooter render from that shared state, so no manual <thead>/<tbody> markup or data-* wiring is needed.
Usage
import { Table, TableHeader, TableBody, TableFooter } from '@mav-labs-inc/mavkit-react'
import type { TableColumn } from '@mav-labs-inc/mavkit-react'
const columns: TableColumn<Order>[] = [
{ key: 'id', header: 'Order' },
{ key: 'total', header: 'Total', kind: 'numeric', cell: row => `$${row.total.toFixed(2)}` },
]
<Table columns={columns} data={orders} getRowId={o => o.id} onSelectionChange={setSelected}>
<TableHeader />
<TableBody />
<TableFooter />
</Table>Example
Click a column header to sort; check a row (or the header checkbox) to select.
| ORD-1042 | Jamie Doe | paid | $128.50 | |
| ORD-1041 | Alex Kim | pending | $42.00 | |
| ORD-1040 | Sam Patel | refunded | $76.25 | |
| ORD-1039 | Taylor Reed | paid | $210.00 |
Props
Table
TableColumn
TableFooter
With no children, shows a row-count / selection summary; pass children (e.g. a Paginator variant="table") to take over the content.
useTable<T>()
Access the enclosing Table’s shared state — for building custom header/body/footer content. Throws if called outside a Table.
Last updated on