Table Editable

Lets people edit cells and add or remove rows and columns.

@paneui/theme@paneui/icons@paneui/table@paneui/menu@tanstack/react-virtualmotion@base-ui/react
Launch checklist · double-click or type to edit6 tasks · 20.5 h

Installation

pnpm dlx shadcn@latest add @paneui/table-editable

Usage

Examples

Read Only

Use when people should browse the data but not change it.

Cell Edit Callback

Use when you save each edit as it commits instead of holding every row in state.

Custom New Rows

Use when new rows or columns need ids or defaults from your own data.

Keyboard

Arrow keys walk the grid. Enter, F2 or just typing edits a cell; Enter / Tab commit and move, Esc cancels, Backspace / Delete clears. On a header, Enter renames and Alt + ← / → moves the column.

Built on Table. See also Table Async.

API Reference

EditableTable

Editable grid on the virtualized Table core. It also passes aria-label, height, headerHeight, overscan, selectable and the selection props, resizable, minColumnWidth, onColumnResize, animateLayout, emptyState and className through to Table. Also accepts every prop of Table.

rows
readonly EditableRow[]
Controlled rows.
defaultRows= []
readonly EditableRow[]
Initial rows when uncontrolled.
onRowsChange
(rows: EditableRow[]) => void
Called after any edit, insert or delete.
columns
readonly EditableColumn[]
Controlled columns.
defaultColumns= []
readonly EditableColumn[]
Initial columns when uncontrolled.
onColumnsChange
(columns: EditableColumn[]) => void
Called after a column is added, renamed, moved or deleted.
onCellEdit
(rowId: string, columnKey: string, value: EditableValue) => void
Called when a cell edit commits.
createRow
(columns: readonly EditableColumn[]) => EditableRow
Build the row the + pills, menus and new-row band insert; defaults to an id and empty cells.
createColumn
(columns: readonly EditableColumn[]) => EditableColumn
Build a new column; defaults to “Column N”.
showAddRow= true
boolean
Show the “New row” band under the last row.
readOnly= false
boolean
Turn off editing, the row and column menus, the insert pills and the new-row band. Keyboard navigation stays.
reorderable= true
boolean
Drag headers to reorder (off when readOnly).
rowHeight= 40
number
Row height in px.
ref
Ref<TableHandle>
Same handle as Table.
PropTypeDefaultDescription
rowsreadonly EditableRow[]—Controlled rows.
defaultRowsreadonly EditableRow[][]Initial rows when uncontrolled.
onRowsChange(rows: EditableRow[]) => void—Called after any edit, insert or delete.
columnsreadonly EditableColumn[]—Controlled columns.
defaultColumnsreadonly EditableColumn[][]Initial columns when uncontrolled.
onColumnsChange(columns: EditableColumn[]) => void—Called after a column is added, renamed, moved or deleted.
onCellEdit(rowId: string, columnKey: string, value: EditableValue) => void—Called when a cell edit commits.
createRow(columns: readonly EditableColumn[]) => EditableRow—Build the row the + pills, menus and new-row band insert; defaults to an id and empty cells.
createColumn(columns: readonly EditableColumn[]) => EditableColumn—Build a new column; defaults to “Column N”.
showAddRowbooleantrueShow the “New row” band under the last row.
readOnlybooleanfalseTurn off editing, the row and column menus, the insert pills and the new-row band. Keyboard navigation stays.
reorderablebooleantrueDrag headers to reorder (off when readOnly).
rowHeightnumber40Row height in px.
refRef<TableHandle>—Same handle as Table.

EditableColumn

Type of each entry in columns.

key*
string
Property read from each row.
header*
string
Header label (renamable).
width
number
Width in px.
minWidth
number
Resize floor.
grow
boolean
Soak up leftover width.
align
"left" | "center" | "right"
Cell alignment.
type= "text"
"text" | "number"
number right-aligns and stores numbers.
placeholder
string
Shown in empty cells.
PropTypeDefaultDescription
key*string—Property read from each row.
header*string—Header label (renamable).
widthnumber—Width in px.
minWidthnumber—Resize floor.
growboolean—Soak up leftover width.
align"left" | "center" | "right"—Cell alignment.
type"text" | "number""text"number right-aligns and stores numbers.
placeholderstring—Shown in empty cells.

EditableRow

{ id: string; [key: string]: string | number | null | undefined }.