RFC 0081 — A new row in the table: typed at the end, or pasted
Status: implemented (2026-11-30) · Target: 0.65.0 · builds on RFC 0078, RFC 0079 and RFC 0080 · see Decisions
Summary
A table that's edited (RFC 0078) changes the rows it has. A new one still goes through the form: New, a route, the fields, Save, and back to the list. For a price list, the week's hours or a stock count, the spreadsheet's way is the expected one again: the empty row at the end, typed into.
<Table
page={list}
bind:query
columns={[
{ key: "name", create: "text" },
{ key: "price", align: "end", edit: "number" },
{ key: "stock", align: "end", edit: "number" },
]}
oneditrow={(row, values) => api.products_update(row.id, { ...inputOf(row), ...values })}
oncreate={(values) => api.products_store({ ...inputOf({}), ...values })}
/>
- The new row is at the end of the table, its first cell saying
"New product…". Its cells are edited with the grid's keys. Leaving the
row, or ⌘Enter, creates it through
oncreate(values), and Esc drops it. - A column's
createis its editor in the new row only: the name a row is opened by, the field set once.editis the editor in both. - What the list is filtered by fills the new row: filtered by Status: Open, a new row starts as open, so it doesn't vanish once made.
- A paste on the new row makes rows: a block of 40 lines from a spreadsheet is 40 new rows, read all or none (RFC 0079), created a row at a time, with progress.
- ⌘Z removes rows it made, with the app's
ondelete(row). make:resource --inlinewritesoncreateandondeletethrough{p}_storeand{p}_destroy.
Motivation
- Lists are filled in, not only changed. The data a business app starts with comes as rows: a price list, a stock count, the week's hours. A form for each, and the list lost each time, is most of the time spent.
- A spreadsheet's paste is the import users already know. RFC 0079 pastes over rows that exist; the same block pasted at the end is the import an app otherwise writes as a CSV upload.
- The pieces exist. The grid and its editors (RFC 0078), a block read
all or none and the write of many with progress (RFC 0079), one step
for undo,
ValidationErrorper field, and the filters' values (RFC 0069).
Current state (0.67)
- With a column's
editandoneditoroneditrow, the table is a grid. Cells are edited where they are; a paste, a fill and a set for the selection write many (RFCs 0079 and 0080); ⌘Z takes back the table's last change. - A paste with lines past the page's last row drops them, and says how many ("3 rows didn't fit").
- There's no way to make a row from the table.
make:resourcewrites a New button to the create route, and{p}_store(input). - A column's
editis the same for every row. The first column of amake:resource --inlinelist isn't edited: it opens the record.
Design
The new row
With oncreate (and creatable, true by default, false for a user who
may not), the grid has one more row after the last, in its own <tbody>
so a sort or a group never moves it:
- Its first cell says
newRow("New row…", or the app'snewLabel: "New product…") until it has a value. - Its cells are the columns with
createoredit, by those kinds. The others are empty and read-only, as a celleditablesays no to. - The grid's keys work in it: ↓ from the last row goes to it, Enter, F2 or typing edits a cell, and a boolean is its checkbox. While editing in the new row, Enter saves the cell and goes to the next one, as Tab does: there is no row below.
- Its values are a draft, kept in the table until it's created. They aren't written one by one.
Making it
- When: the focus leaves the new row (↑, a click on another row, Tab out of the table) with a value in it, or ⌘Enter (Ctrl+Enter) in it. An untouched new row is left as it is.
- What:
oncreate(values), the draft's values by column, with the defaults first (below). It resolves to the row made (the store command's answer). - While: the row shows its values with the pending dot (RFC 0039), and a second new row is ready under it, so the user types on.
- After: the row made stays where it is, at the end of the page, marked Added until the page changes, even when the list's sort or filters would put it elsewhere. The live query's re-run brings it into its place on the next page change. A plain array's row goes where the app's array puts it.
- When it fails: a
ValidationErrorkeeps the draft, opens the editor on the first field with a message (aria-errormessage), and the other fields' messages mark their cells (RFC 0079's marks). A field the row has no cell for says its message in a toast. Any other failure: the draft stays, and a toast says why. - Esc in the new row, not editing: the draft is dropped.
The defaults
The new row starts with, in order (the last wins):
- The filters' values: an options filter with one value
(
status: ["open"]). A search or a range isn't one. A row made in Open is open. - The group's value: made in a grouped table, the row is in the group the focus was in.
- The app's
newRow: an object, or(query) => values.
They show in the new row's cells, in their place, before anything is typed.
Paste on the new row
On the new row, a paste makes a row for each line:
- The block is read by the columns from the cursor, with
createoredit, all or none (RFC 0079). A value that doesn't read writes nothing: the message says which line and column. - More than 20 lines: the user confirms first ("Add 40 rows?").
- Each line is one
oncreate, one at a time in the block's order (so the rows are made in it), with RFC 0079's progress and Cancel. - A line that fails stays in the new row with its message, and the rest go on: "Added 38 rows. 2 couldn't be added." The first that failed is the new row's draft, its message on the cell.
A paste over the existing rows that has lines past the last still drops them, as today; a paste on the new row is the way to add.
Undo
Making a row (one, or a paste's) is a step. With ondelete(row),
⌘Z deletes the rows it made, after a confirm when it's more
than one ("Remove the 38 rows just added?"), and ⇧⌘Z makes
them again from the values they were made with. Without ondelete, a
row made isn't a step, and ⌘Z undoes what was before it.
Words
newRow, added, addRows(n), addedSome(done, failed), adding(done, total), addingLabel, removeAdded(n), notAdded(message), in
words.js and en/nb.
make:resource --inline
- The first column (the record's name, which opens it) gets
createby its kind, and stays a link in the rows that exist. oncreateisapi.{p}_store({ ...inputOf({}), ...values }), filesnull;ondeleteisapi.{p}_destroy(row.{pk}). Over a backend, a write queued offline is done as far as the list goes, as an edit is.creatableis$can("{p}.store")with abilities.
Implementation plan
ui/src/internal/edit.js: a column's kind in the new row (createKind), the defaults from filters, group andnewRow, and a block read into drafts.Table.svelte: the new row's<tbody>, its cells and keys, the draft, making it on leaving the row or ⌘Enter, the row made kept at the end, failures on its cells, Esc, paste on it with confirm and progress, and the undo step withondelete.- Words, in
words.jsanden/nb. rata make:resource --inline: the first column'screate,oncreate,ondelete,creatable, and its test and smoke.- Tests: the new row's cells, keys and Enter; made on leaving it and on
⌘Enter, untouched left alone, Esc; the defaults from a filter, a group
and
newRow; the row made kept at the end and marked; aValidationErroron its fields and on a field with no cell; a paste of lines, all or none, the confirm, progress, a line that fails;creatable={false}; undo with and withoutondelete. - Docs:
table.md("A new row"), a gallery example, the keyboard table, the skills,resources.md, CHANGELOG.
Open questions
- When is the row made: leaving it, or a key? Recommendation: leaving it, and ⌘Enter for at once. It's how a spreadsheet's user works (they type across and go on), and a draft that's only kept until a key is pressed would be lost by the click they expect to save it.
- Where does a row made go: its place, or the end? Recommendation: the end, until the page changes. A row that jumps to page 3 the moment it's made, or vanishes because the list is sorted by a column it hasn't got, is a row the user thinks is lost.
- A paste on the new row: one
oncreatea line, or one call? Recommendation: a line at a time, in order. Progress, Cancel and a line that fails without the others, as RFC 0079's write; a store command per record is what apps have. - Undo of a row made: delete it? Recommendation: with the app's
ondelete, after a confirm past one row. Undo that can't take a paste of 40 rows back is the case undo is for; withoutondeletethe table can't, and says nothing it can't do. - The filters' values as defaults? Recommendation: only an options filter with one value. A range or a text search doesn't say what a new row's value should be.
Decisions
Accepted 2026-11-30, with the open questions' recommendations:
- The row is made when the focus leaves it, and at once with ⌘Enter.
- A row made stays at the end until the page changes.
- A paste on the new row is one
oncreatea line, in order, with progress, Cancel and a line that fails on its own. - Undo deletes the rows made with the app's
ondelete, after a confirm past one row; without it, a row made isn't a step. - Only an options filter with one value fills a new row's default.
As built
As designed, with these differences:
- The new row waits while it's made. Its cells are read-only, with
the pending dot, until
oncreateanswers; then it's empty for the next. There's no second new row under it meanwhile: a row that fails comes back into the one new row, with nothing typed after it to lose. - The rows just added are shown, not edited, at the end of the page
with the app's
cellandactions, until the page brings them. They're edited in their place from then on. - The group is the one of the row the focus was last on.
- A paste on the new row skips the columns it spans that have neither
createnoredit, without counting them: the rows are new, so there's nothing left unchanged to tell of. make:resource's abilities are the list's own:creatableasks for{p}.create, as its New button does (not{p}.store), andondeleteis given only to a user with{p}.delete. The new row's input is the form's blank (nullfor an optional text or JSON), with what was typed over it.- A row queued offline (over a backend) has no row yet: it isn't shown as added, and isn't a step to undo.
Not in this RFC
- A row inserted between others, or duplicated from one.
- Deleting rows from the table other than by undo (a Delete in the row
menu is the app's
actions). - A column of a related record (
belongs_to) picked with a combobox in the new row. - Rows made by a paste over the existing rows' end (past the last row).
Alternatives considered
- A New row that opens the form. It keeps the form's round-trip, which is what the table is for avoiding.
- Make the row on the first value typed, then edit it. One write each, but a row made before its required fields are typed fails on the server, or exists half-filled.
- An import dialog for pasted rows. It's another screen to learn for what a paste already says.