AdaptTable for Tailwind

Inline cell editing in Tailwind

Mark a column editable, pass onCellEdit, and double-click opens a Tailwind editor in the cell. Enter commits, Escape cancels, Tab moves to the next editable cell.

The table never mutates your rows. It hands your handler the row, the column and the new value, and shows whatever you hand back — which is what makes optimistic updates, validation and rollback yours to decide.

With cellNavigation on, the same handler receives whole blocks: paste a spreadsheet range with Ctrl+V, drag the fill handle, and undo the entire paste with one Ctrl+Z.

The editor is a native input or select carrying the map's field classes with an indigo focus ring; the validation and rollback parts carry no classes in this map, so a rejected commit reads as browser-default text.

The code

import { DataTable } from "@adapttable/unstyled";

const columns = [
  { key: "name", editable: true },
  {
    key: "status",
    editable: true,
    editor: { type: "select", options: ["active", "on-leave"] },
  },
  { key: "budget", editable: true, editor: "number" },
];

export function People({ rows, onSave }) {
  return (
    <DataTable
      data={rows}
      columns={columns}
      rowKey={(row) => row.id}
      cellNavigation
      editHistory
      onCellEdit={(row, key, value) =>
        onSave({ ...row, [key]: value })
      }
    />
  );
}

Install

pnpm add @adapttable/unstyled @adapttable/core

The same feature in the other kits

More Tailwind features

Reference: cell-editing, cell-navigation. More of this kit: AdaptTable for Tailwind, or the live demo.