The onChange callback fires whenever the user interacts with the spreadsheet — selecting cells, switching sheets, editing data, and structural changes like inserting rows or columns.
All events include a type discriminator and a timestamp (Unix milliseconds). Operation events also include sheetName.
import { SpreadsheetEditor } from " @grid-is/editor-react " ;
import type { EditorEvent } from " @grid-is/editor-react " ;
const handleChange = ( event : EditorEvent ) => {
console . log ( " Selected: " , event . selection ) ;
console . log ( " Switched to: " , event . sheetName ) ;
console . log ( " Wrote: " , event . cellId , " = " , event . value ) ;
// ... handle other event types
return < SpreadsheetEditor model = { model } onChange = { handleChange } /> ;
Type Key fields Description selection-changeselectionUser moved selection to a different cell or range sheet-changesheetName, previousSheetNameUser switched sheet tabs
Type Key fields Description write-cellcellId, valueCell value changed clear-cellsrangeCell contents cleared format-cellsrange, formatCell formatting changed pasterangeContent pasted fillsourceRange, targetRangeCells filled (drag to fill)
Type Key fields Description insert-rowrow, directionRow inserted above or below insert-columncolumn, directionColumn inserted left or right delete-rowsstartRow, countRows deleted delete-columnsstartColumn, countColumns deleted resize-rowrow, heightRow height changed resize-columncolumn, widthColumn width changed
Type Key fields Description move-cellsfromRange, toRangeCells moved move-rowsfromRange, toRangeRows moved move-columnsfromRange, toRangeColumns moved
Type Key fields Description add-sheetsheetNameNew sheet added delete-sheetsheetNameSheet deleted rename-sheetoldName, newNameSheet renamed
// Navigation events only (selection + sheet switching)
type ViewerEvent = SelectionChangeEvent | SheetChangeEvent ;
// All events including data operations
type EditorEvent = ViewerEvent | WriteCellEvent | PasteEvent | ClearCellsEvent | ...;