Ledger Table
ReactFull-bleed rows with the title inside the grid, a numbered rail and sortable headers.
| # | ||||||
|---|---|---|---|---|---|---|
| 01 | R-2037 | atlas-l | tool-use | 0.957 | 1,120 | pass |
| 02 | R-2041 | atlas-l | support-qa | 0.912 | 840 | pass |
| 03 | R-2040 | atlas-m | support-qa | 0.884 | 410 | pass |
| 04 | R-2039 | atlas-s | support-qa | 0.801 | 160 | drift |
| 05 | R-2038 | local/32b | support-qa | 0.742 | 1,290 | fail |
Install
$ npx shadcn@latest add https://spotcheckui.com/r/ledger-table.jsonNo motion engine needed.
Usage
import { LedgerTable, type LedgerColumn } from "@/components/spotcheck/ledger-table"
const columns: LedgerColumn<Run>[] = [
{ key: "id", label: "Run", emphasis: true },
{ key: "score", label: "Score", numeric: true },
]
<LedgerTable title="Eval runs" rows={runs} columns={columns} rowKey="id" defaultSort={{ key: "score", dir: "desc" }} />Sorting needs a client component, so a custom render has to come from one too. Define columns in a "use client" file.
Props
- title * Required
stringDefault —Printed inside the table, and names it for screen readers. - rows * Required
Row[]Default — - columns * Required
LedgerColumn<Row>[]Default — - rowKey * Required
stringDefault —The field that uniquely identifies a row. - defaultSort
LedgerSort<Row>Default — - className
stringDefault —
Keyboard
| Tab | Move between column headers |
|---|---|
| Enter | Sort by the focused column |
| ← → | Scroll a wide table once it has focus |
Reduced motion
Rows invert on hover at once, with no fade.