Skip to documentation content

Records Table

Show records in a table where some columns are filled in by an agent, one cell at a time.

records-table-demo

Overview

Records Table is a table in which some columns are generated: an agent reads each record and fills in a summary, a category, a score. Each generated cell shows where it stands, and a line above the table counts how many are done.

It shows the state you pass for every cell. Running the agent, and deciding the order, are your application's work.

Use Data Grid when people need to sort, resize, or edit columns. The Beautiful UI original also had column settings and resizing, which Data Grid already covers.

Anatomy

RecordsTable
  • ColumnsOrdinary columns, and generated columns marked Generated in the header
  • Generated cellQueued, working, a value, or an error with Try again
  • ProgressA count of generated cells that are done

Installing records-table brings Button and Table along as registry dependencies.

Behavior

Generated cells

A generated cell is queued, running, done with a value, or error with an optional message. A cell with no state reads as queued.

Trying again

Pass onRetry to show Try again in every failed cell. It calls your handler with the row and column ids. The button sits inside the line, so a failed cell does not make its row taller.

Progress

The line above the table counts done cells across every generated column. It is left out when the table has no generated columns.

Accessibility

The table uses native markup with column headers and is named by label. A generated column's header reads its name, then "Generated", set apart by a dot and a lighter weight. Queued, working, and failed are words in the cell, so no state depends on an icon or a color.

Try again is named with its column and row, such as "Try again: Payment summary for Harbor Paper Co.". The progress line is a polite status, so each completed cell is announced as a count, not as a re-reading of the table. With reduced motion, the working icon does not rotate.

KeyAction
TabMove across the Try again buttons
Enter or SpaceTry the focused cell again

Installation

npx honestui@latest add records-table

Usage

import { RecordsTable } from "@/components/ai/records-table"

<RecordsTable
  label="Suppliers"
  columns={[
    { id: "name", header: "Supplier" },
    { id: "summary", header: "Payment summary", isGenerated: true },
  ]}
  rows={suppliers.map((supplier) => ({
    id: supplier.id,
    name: supplier.name,
    cells: { name: supplier.name },
    generated: { summary: enrichment.cellFor(supplier.id) },
  }))}
  onRetry={(rowId, columnId) => enrichment.retry(rowId, columnId)}
/>

Examples

All cells done

A settled table. The progress line reads 2 of 2.

records-table-static

API reference

RecordsTable

PropTypeDefaultDescription
labelstringRequiredNames the table.
columnsRecordsTableColumn[]RequiredEach has id, header, and an optional isGenerated.
rowsRecordsTableRow[]RequiredThe records.
onRetry(rowId: string, columnId: string) => voidNonePassing it shows Try again in failed cells.
labelsPartial<RecordsTableLabels>EnglishState words, button names, and the progress text.
classNamestringNoneAdded to the root.

Types

ExportShape
RecordsTableRowid, name, cells keyed by column id, and optional generated keyed by column id
GeneratedCellstatus of "queued", "running", "done" (with value), or "error" (with optional message)