RFC 0078 — Editing in the table: a cell changed where it is
Status: implemented (2026-11-29) · Target: 0.65.0 · builds on RFC 0012, RFC 0039 and RFC 0069 · see Decisions
Summary
To change one value in a list today, the user opens the row, finds the field in its form, saves, and goes back to the list. For the work a desktop business app is used for (a status for twenty invoices, a price list, the hours of a week), the spreadsheet's way is the expected one: the cell is changed where it is.
<Table
page={list}
bind:query
columns={[
"name",
{ key: "status", edit: { options: [["open", "Open"], ["paid", "Paid"]] } },
{ key: "credit", align: "end", edit: "number" },
]}
onedit={(row, key, value) => api.customers_update(row.id, { ...inputOf(row), [key]: value })}
/>
- A column's
edit:"text","number","date","boolean"or{ options }, with the same kinds as RFC 0069's filters.editable(row)says, per row, whether this one may be changed (a locked invoice, an ability). - The keys of a spreadsheet: with an editable column, the table is a grid. Arrows move between cells. Enter or F2 edits a cell, and typing starts editing over its value. Enter saves and goes down, Tab saves and goes to the next editable cell, and Esc leaves the value as it was. A double click edits too.
onedit(row, key, value)writes it: the app's update command. The cell shows the new value at once, with RFC 0039's dot until the write is done. If the write fails, the value goes back. AValidationErrorfor the field stays on the cell, which keeps editing.make:resource --inlinewrites the lists with it: editable columns for the simple types, andoneditthrough the update command.
Motivation
- The common edit is one value. A status, an amount, a date, a checkbox. A form round-trip for each is most of the time spent, and the user loses their place in the list each time.
- Lists are where the work is. With filters, views, grouping and totals (RFCs 0067–0077), the list is where users decide what to change. The totals in the foot and the group subtotals should follow an edit at once, which a form on another route can't show.
- The pieces exist. Optimistic writes and the pending dot (RFC 0039),
validation errors per field (
ValidationError), the filter kinds and their inputs (RFC 0069), and the selection's keyboard (RFC 0012). What's missing is the cell as an editor, and the grid's keys.
Current state (0.66)
- A row is focusable (with
onrowclickorselect). ↑/↓ move between rows, Enter opens the row, Space selects it. A cell is drawn by itsformator the app'scell(row, column)snippet, and a click on an input, button or link in a cell is the cell's. pendingmarks rows with a write not yet confirmed (RFC 0039).- A filter's kind is
"text","range"(numbers),"dates"or{ options }, with an input for each in the filter's panel. make:resourcewrites{p}_update(id, input)taking the whole input, and a form that builds it from the record (fromRecord,payload).ValidationError.errorsis the field-to-messages map thatFormshows under its fields.
Design
A column's edit
edit?: "text" | "number" | "date" | "boolean" | { options: [value, label][] }
editable?: (row) => boolean // on the Table: may this row be changed
onedit?: (row, key, value) => Promise<unknown>
- With no
onedit,editdoes nothing: a table is read-only unless the app says how to write. editable(row)false: the row's cells are shown as today, not focusable as editors, and Enter on them opens the row.- A column with
celldrawn by the app is still editable: the snippet draws the cell, and the editor replaces it while editing.
The grid
With an editable column and onedit, the table's role is grid and its
cells take the focus, one at a time (a roving tabindex):
| Key | |
|---|---|
| ← → ↑ ↓ | The next cell. |
| Home / End | The row's first or last cell. |
| Enter, F2 | On an editable cell: edit it. On another cell: open the row, as today. |
| A character | On an editable text or number cell: edit it, starting from that character. |
| Space | On a boolean cell: toggle it, and save. Elsewhere, select the row, as today. |
| Delete, Backspace | On an editable cell that may be empty: empty it. |
| While editing: Enter | Save, and move to the cell below. |
| While editing: Tab / Shift+Tab | Save, and move to the next or previous editable cell, row by row. |
| While editing: Esc | Stop editing and keep the value as it was. |
A double click on an editable cell edits it. A single click focuses it,
and opens the row only on a cell that isn't editable, so onrowclick and
editing can share a table. A click outside the editor saves it, as
Enter does without moving.
The selection's keys stay. Space on the checkbox's cell, and on
a cell that isn't boolean, selects the row. ⌘A and
⌘C work as they do on a row. ⌘C on a cell copies the
row, or the selected rows, as RFC 0066 does.
The editors
The same inputs as the filter panel: Input for text and numbers (with
inputmode, and the column's align), DatePicker for a date, Select
for options, Checkbox for a boolean. A boolean cell is its checkbox
even when it isn't being edited. The editor fills the cell, and the row
keeps its height.
The value given to onedit has the column's type: a number or null
for an empty number, "YYYY-MM-DD" for a date, the option's value, and
true/false. Text is trimmed, and empty text is null, as
make:resource's forms send it.
The write
- On save, if the value is unchanged, nothing is written.
- The cell shows the new value at once, and the row has the pending dot
(RFC 0039) while
oneditruns. The foot's totals and the group's subtotals over a plain array follow it. Over a live page they follow when the query runs again. - When
oneditresolves, the cell keeps the value until the page brings the row with it (the live query's re-run, RFC 0017). - A
ValidationErrorwith the column's key: the editor opens again with the value the user typed and the message under it (aria-invalid,aria-errormessage). Errors for other fields (whole-input commands validate every field) and any other failure: the value goes back, and a toast says the first message, "Couldn't save Credit: …". - A write queued offline (RFC 0007) is done as far as the table is concerned; the pending dot stays until the outbox sends it.
make:resource --inline
- The index view's columns of text, number, date, boolean and enum
fields get
edit(abelongs_to, a file, JSON and a long text don't). A unique field is still editable; its 422 shows on the cell. oneditbuilds the input from the row as the form'sfromRecordandpayloaddo (both written into the index view asinputOf(row)), and calls{p}_update. It's.optimistic()when the resource is.editableis() => can("{p}.update")when the update command has an ability.- Without
--inline, the lists stay as they are.
Implementation plan
ui/src/internal/edit.js: the kinds, the value from the editor's text (valueOf(kind, text)), unchanged-ness, the next editable cell for Tab, and the overlay of values not yet in the page.Table.svelte: the grid's focus (rovingtabindexon cells, the arrows, Home/End), the editor in a cell, save/cancel, the write with the pending dot, errors on the cell, the double click, and the click that opens only on a non-editable cell.- Words:
edit(column),editing(column),saveFailed(column, message),emptyfor an emptied cell's announcement, inwords.jsanden/nb. rata make:resource --inline: the columns'edit,inputOf,onedit,editable, and its tests.- Tests: the keys (each one in the table above), a double click, the
write and its pending dot, unchanged values, a
ValidationErroron the field and on another field, a failure,editable(row), a boolean cell, totals following, acellsnippet, and the selection's keys still working. - Docs:
table.md("Editing in the table") with a gallery example, the keyboard table, the skill,resource.mdfor--inline, CHANGELOG.
Open questions
- A grid only when something is editable? Recommendation: yes. A read-only table keeps its rows as the focus stops, which is what a list that only opens rows needs; the grid's cell-by-cell focus is for tables that are edited.
- Does a click open the row, or focus the cell? Recommendation: a
click on an editable cell focuses it and a double click edits; a click
on any other cell opens the row, as today. The generated lists with
--inlinekeep opening from the name column. make:resourcelists editable by default, or behind--inline? Recommendation: behind--inlinefor now. Existing apps keep the lists they have, and the default can change once apps have used it.- Pasting a block from a spreadsheet, fill down, undo? Recommendation: not in this RFC. They each write many rows at once, which needs the bulk write this RFC doesn't have. They come next, on top of the grid.
As built
ui/src/internal/edit.js:editKind,editOptions,textOf,valueOf(the column's type,undefinedfor text that isn't one: "1 234,5" is 1234.5),same,cellKey,typesOver, andfailureOf(aValidationError's message for the field, else the first message, else the error's).Table.svelte:oneditandeditableprops.gridModeis aneditcolumn andonedit; then the table hasrole="grid", each body celldata-col, a rovingtabindex(cursorAt: the cursor while its row is on the page, else the first cell) andaria-readonlywhen it isn't editable, and the rows aren't focus stops. The cell's keys (onCellKey) handle the arrows, Home/End, Enter/F2, typing over, Delete/Backspace and a boolean's Space, and hand the rest to the row's (rowKeys, split fromonRowKey): ⌘C and the menu, Space to select, ⌘A, Esc, Quick Look, and Enter on a cell that isn't editable to open the row. Moving is by the rows drawn (tr[data-key]), across the groups.- The write:
overlay(aMapby cell) holds a value from the moment it's saved;withEditsapplies it to a plain array before it's searched, filtered and totalled, and to a live page's rows. A confirmed value stays until the rows change (rowsor the page'sdata, by identity).writingcounts a row's writes in flight, andunsentshows the pending dot for them. AValidationErrorfor the column reopens the editor with the typed text,aria-invalidand anaria-errormessage(role="alert"); anything else is a toast, "Couldn't save Amount: …". - The editors are native: an
<input>for text and numbers (inputmodedecimal),<input type="date">for a date, and a<select>for options (a change saves at once). The RFC namedDatePicker; the native date input is used instead, as it keeps the cell's height and leaves Enter, Tab and Esc to the grid, with no popover. A boolean is theCheckbox, in the cell always, disabled where the row isn'teditable. - Words:
editCell,saveFailed,notANumber,notADate,notAnOption,emptied, inwords.jsanden/nb. rata make:resource --inline(with--viewor--generate):Field::edit()gives a field's kind (a file, a reference, long text and JSON have none); the columns after the first getedit, unless the column's name isn't the field's (the row and the input disagree on its key). The index view getsinputOf(row)(every non-file field of the input, as the row has it),edit(row, key, value)calling{p}_update(a file argumentnull; over a backend, aqueuedrejection is a write done),onedit={edit}, and with abilitieseditable={(row) => row.can?.update ?? $can("{p}.update")}. Enums aren't a field typemake:resourcehas, so{ options }is for an app's own columns.- Tests:
ui/src/table-edit.test.js(20), the gallery'stable/editexample,inline_edits_the_lists_cells_through_the_update_commandand the flag's test in ratatosk, andscripts/smoke-resource.shgenerating its Invoice with--inlineand building it.
Decisions
Accepted 2026-11-29, with the open questions' recommendations:
- A grid only when something is editable: an editable column and
onedit. A read-only table keeps its rows as the focus stops. - A click on an editable cell focuses it, a double click edits it; a click on any other cell opens the row, as today.
make:resourcebehind--inline: the lists it writes stay as they are without it.- Pasting a block, filling down and ⌘Z come later, on top of the grid, with a write of many rows.
Not in this RFC
- Pasting a block of cells, filling down, and ⌘Z.
- A new row typed at the end of the table.
- A column of a related record (
belongs_to) edited with a combobox. - A write of one field (a
PATCHwith only that key);oneditis the app's, and can send that if its command takes it.
Alternatives considered
- Edit a row at a time (the row becomes a form, with Save and Cancel). Fewer writes, but it's the form's round-trip in another place, and it doesn't have the keys a list's user expects.
- A separate
<Grid>component. It would repeat the table's paging, filters, views, groups, totals and selection. The grid's keys are a mode of the table instead. - Save on every keystroke. Many writes, and a half-typed value checked by the server. A save is on Enter, Tab or leaving the cell.