Cell Editing

Edit values in place. Mark columns editable, then persist changes with onCellEdit.

Mark columns editable

Set editable: true on each column users can change. Column type picks the editor (string, number, boolean, date, or enum).

TypeScript
{
accessor: "firstName",
label: "First Name",
width: "1fr",
type: "string",
editable: true,
}

Handle onCellEdit

Update your data when onCellEdit fires. It receives accessor, newValue, and the row.

React TSX
const handleCellEdit = ({ accessor, newValue, row }) => {
setRows((prev) =>
prev.map((r) => (r.id === row.id ? { ...r, [accessor]: newValue } : r))
);
};
<SimpleTable
columns={columns}
rows={rows}
onCellEdit={handleCellEdit}
/>

Editors by type

Use type for the matching control. Enum columns also need enumOptions.

TypeScript
const columns: ReactColumnDef[] = [
{ accessor: "firstName", label: "First Name", type: "string", editable: true },
{ accessor: "salary", label: "Salary", type: "number", editable: true },
{ accessor: "isActive", label: "Active", type: "boolean", editable: true },
{ accessor: "hireDate", label: "Hire Date", type: "date", editable: true },
{
accessor: "role",
label: "Role",
type: "enum",
editable: true,
enumOptions: [
{ label: "Developer", value: "Developer" },
{ label: "Designer", value: "Designer" },
{ label: "Manager", value: "Manager" },
],
},
];

Copy and paste

Ctrl/⌘+C copies selected cells; paste from spreadsheets works too. Only columns with editable: true accept pasted values — others are skipped.

Example

Double-click a cell to edit. Use Code or StackBlitz for the full example.

Props

Cell Editing Configuration

PropertyRequiredDescriptionExample
ColumnDef.editable
boolean
Optional
When true, cells in the column can be edited (and accept paste).
ColumnDef.type
Optional
Chooses the cell editor and validation for editable columns.
Options:
string
number
boolean
date
enum
ColumnDef.enumOptions
EnumOption[]
Optional
Dropdown options for enum columns.
Optional
Fires when a cell value changes. Update your rows from the callback.