A bare data table: describe `columns` once (a `title` plus a `dataIndex` or a custom `render`), pass `data`, get a `<table>` back. No sorting, pagination or empty state — add those around it.
Examples of v0.2.4 are shown as code; only the latest version runs live. Open the live examples →
Basic Table
1interface Invoice {2 id: string;3 customer: string;4 amount: number;5 status: "paid" | "overdue";6}78const invoices: Invoice[] = [9 { id: "inv-1", customer: "Acme Co", amount: 240, status: "paid" },10 { id: "inv-2", customer: "Globex", amount: 90, status: "overdue" },11 { id: "inv-3", customer: "Initech", amount: 512, status: "paid" },12];1314const basicColumns: TableColumn<Invoice>[] = [15 { key: "customer", title: "Customer", dataIndex: "customer" },16 { key: "amount", title: "Amount", dataIndex: "amount" },17];1819const BasicTable = () => (20 <Table columns={basicColumns} data={invoices} rowKey={(row) => row.id} />21);2223render(<BasicTable />);
Table With Custom Cells
1interface Invoice {2 id: string;3 customer: string;4 amount: number;5 status: "paid" | "overdue";6}78const invoices: Invoice[] = [9 { id: "inv-1", customer: "Acme Co", amount: 240, status: "paid" },10 { id: "inv-2", customer: "Globex", amount: 90, status: "overdue" },11 { id: "inv-3", customer: "Initech", amount: 512, status: "paid" },12];1314const richColumns: TableColumn<Invoice>[] = [15 { key: "customer", title: "Customer", dataIndex: "customer" },16 {17 key: "amount",18 title: "Amount",19 dataIndex: "amount",20 render: (value) => `$${value}`,21 },22 {23 key: "status",24 title: "Status",25 render: (_value, row) =>26 row.status === "overdue" ? "⚠️ overdue" : "✓ paid",27 },28];2930const TableWithCustomCells = () => (31 <Table columns={richColumns} data={invoices} rowKey={(row) => row.id} />32);3334render(<TableWithCustomCells />);
Empty Table
1interface Invoice {2 id: string;3 customer: string;4 amount: number;5 status: "paid" | "overdue";6}78const basicColumns: TableColumn<Invoice>[] = [9 { key: "customer", title: "Customer", dataIndex: "customer" },10 { key: "amount", title: "Amount", dataIndex: "amount" },11];1213const EmptyTable = () => (14 <Table columns={basicColumns} data={[]} rowKey={(row) => row.id} />15);1617render(<EmptyTable />);