Skip to content
Sign upPro
Apps SDKSheet widgetMenu

Sheet widget (Pro)

ProIncluded in $99

A small table the assistant hands over to be corrected: edit a cell, watch totals follow, and send exactly what changed back.

ProTrip costs to split. Move with the arrows and type; totals follow, and Send hands the edits back.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/sheet-widget

Needs chatcn Pro

This command works with a Pro license, along with every Pro component.

Or start free: sign up and get three Pro components on us, with a new one every month.

Usage

tsx
import { SheetWidget } from "@/components/ui/chatcn/pro/sheet-widget"

<SheetWidget
  title="Lisbon trip costs"
  columns={[
    { id: "item", header: "Cost" },
    { id: "amount", header: "Amount", type: "currency", total: "sum" },
    { id: "share", header: "Each of 4", type: "currency", total: "sum",
      compute: (row) => Number(row.amount) / 4 },
  ]}
  defaultRows={rows}
  currency="EUR"
  onSubmit={(changes) => sendToAssistant(changes)}
/>

This is not a spreadsheet to live in; for that there is the AI spreadsheet. It is the table an answer comes with, small enough to read at a glance and quick to fix. Move with the arrow keys and type to replace a cell, or press Enter to change it; Enter saves and moves down, Tab moves across, Escape cancels. Worked out columns (compute, marked ƒ) and totals follow at once, and a changed total turns over softly. A cell that doesn't read as a number stays open with the reason under the table. Every edited cell keeps a blue corner, and with onSubmit a bar counts the edits with Undo all and Send, which passes the list of { rowId, columnId, from, to }. formulas lets number cells take arithmetic such as =120*3+40, parsed without eval; it is off by default so an equals sign is never a surprise. baseRows restores a draft against what the assistant sent.

Examples

States

ProSeats and shares with no change bar, and a restored draft with two edits waiting to be sent.

Props

PropTypeNotes
columnsSheetWidgetColumn[]{ id, header, type?, compute?, total?, width? }
defaultRowsSheetRow[]{ id, ...cells }
baseRowsSheetRow[]What edits count against. Default defaultRows
currency, localestringFor currency cells. Default USD
formulasbooleanArithmetic in number cells. Off by default
addablebooleanShows Add row
onRowsChange(rows) => voidEvery saved edit
onSubmit(changes, rows) => voidShows the change bar
labelsPartial<SheetWidgetLabels>Every string, for translation

Keyboard

KeyAction
Arrow keys, Home, EndMove between cells; Ctrl with Home or End goes to the corners
Enter, F2, or typingEdit the cell
Enter, TabSave and move down or across; Shift goes back
EscapeCancel the edit
DeleteClear the cell

Accessibility

  • A real table with the grid pattern: one tab stop, arrow keys inside.
  • Edited and worked out cells say so to screen readers; an error is an alert tied to the input.
  • The change count is a polite live region.

Motion

A changed total fades and unblurs in 260 ms. The error and the Sent note rise in. Reduced motion shows them in place.