Cell selection

Letting the user select one cell at a time with selectable.cells.

Last updated August 24, 2026

selectable.cells takes a CellSelectionMode — only false or "single": a cell addresses one value, so there is no "multiple" and no range to take. A click moves the selection to that cell; Ctrl-click on the selected cell clears it.

Single-select cells#

selectable={{ cells: "single" }}

Live example

This example runs as a real project on StackBlitz.

Open in StackBlitz
<DataGridComponent
  columns={columns}
  dataSource={rows}
  getRowId={(row) => String(row.Id)}
  selectable={{ cells: "single" }}
  onCellSelect={({ cell }) => console.log(cell.value)}
/>;

Props#

PropTypeDefaultDescription
selectable.cellsfalse | "single"falseHow many cells the user may select at once — no "multiple": a cell addresses one value, so there is no range to take.
defaultCellSelectionCellSelectionStateThe cell selected to start with — a SelectedCellRef ({ rowId, columnId }), or null for none. Uncontrolled.
onCellSelect / onCellDeselect(event: CellSelectEvent) => voidOnce for the cell selected, once for the cell deselected.
onCellSelectionChange(event: CellSelectionChangeEvent) => voidOnce per change with what was selected and what was deselected — one interaction can fill both, since moving between cells deselects and selects at once.

Payload shapes#

onCellSelect/onCellDeselect fire a CellSelectEvent<Row>, onCellSelectionChange a CellSelectionChangeEvent<Row>:

TypeFieldTypeDescription
CellSelectEvent<Row>cellSelectedCell<Row>The cell selected or deselected.
selectionCellSelectionStateThe selected cell's address, at that point.
CellSelectionChangeEvent<Row>selectedSelectedCell<Row> | nullThe cell now selected, or null if this change only cleared one.
deselectedSelectedCell<Row> | nullThe cell that was selected before, or null if there wasn't one.
selectionCellSelectionStateThe same as selected, reduced to its address — SelectedCellRef | null.

Each carries the cell as a SelectedCell<Row>, resolved down to the value it shows:

FieldTypeDescription
rowIdstringThe cell's row id.
columnIdstringThe cell's column id.
rowRowThe whole row this cell belongs to.
columnResolvedColumn<Row>The resolved column — see imperative handle.
rowIndexnumberPosition among the rows as rendered.
columnIndexnumberPosition among the columns as displayed.
valueunknownThe cell's value, read off the column's field path.

Reading selection outside the grid's own tree#

useSelectionState, documented on row selection, covers row, column, and cell selection together as one hook rather than three — its cellSelection field is this page's CellSelectionState.

Edit this page on GitHub