Fill handle
Drag the small square at the bottom right of the selection with fillHandle to fill with a series or copies (Excel's AutoFill)
Pass the fillHandle prop, and a small square (the fill handle) appears at the bottom right of the selection (or the active cell if there is none). Dragging it fills, as Excel's AutoFill does, with the continuation of the original values (Fill Series) or repetitions of them (Copy Cells). It's an opt-in feature, off by default.
Demo (production plan > drag to fill lots, dates and weekdays)
- Select two rows of "Lot" and drag the square down to continue with
LOT-003,LOT-004…. "Date" and "Weekday" advance one day at a time even from a single cell. - Dragging three rows of "Process" repeats Cutting → Grinding → Inspection (copies).
- Dragging two rows of "Qty" (50, 100) continues arithmetically with 150, 200 …. Values over 1000 aren't written because of
validate(reject). - The "Owner" column can't be edited, so it isn't rewritten even when inside the range.
- While dragging, the range to fill is shown with a dotted line, and the value going into the farthest cell appears near the pointer. Pressing
Ctrl(⌘on Mac) swaps series and copy, andEscapecancels. - On release, a button appears at the bottom right. Press it to choose again between "Fill Series / Copy Cells". One undo goes back to before the fill.
- Double-click the square to fill down as far as the column to its left has values.
Usage
<SpreadsheetGrid rows={rows} onRowsChange={setRows} columns={columns} fillHandle />It needs somewhere to write. Without onRowsChange (clientSide) or dataSource.updateRows (serverSide), the handle doesn't appear. It doesn't appear while readOnly either, nor when the selection is only synthetic columns or only label / group rows (no values to fill from).
Replacing the values to fill
Pass an object to fillHandle, and getFillValue decides the value written for each cell being filled. Return defaultValue for cells you leave as the default.
fillHandle={{
getFillValue: ({ column, defaultValue, sourceValues, index, direction, kind }) => {
// round the qty column to multiples of 10
if (column.key === 'qty' && typeof defaultValue === 'number') {
return Math.round(defaultValue / 10) * 10;
}
return defaultValue;
},
}}| Argument | Description |
|---|---|
column / row / rowIndex | The column / row (before writing) / view row index of the cell being filled. |
sourceValues | The original values, in the order of the fill direction; the last element is nearest the cell being filled. |
index | The position, with the cell right after the original range as 0 (label / group rows aren't counted). |
direction | 'down' | 'up' | 'right' | 'left' |
kind | How this column / row is filled ('series' | 'copy'). |
defaultValue | The value written by default. |
getFillValue isn't called for cells that can't be edited. It's also called to show the tooltip while dragging (the farthest cell's value), so make it free of side effects. Returned values also go through validate, and invalid ones aren't written with validationMode: 'reject'.
How the fill kind is decided
It's decided per column (when dragging up or down) / per row (when dragging left or right). Values with a recognizable continuation give a series; a single number, a single string of digits only, and values without a continuation give copies. Dragging a select editor column up or down also copies (since 1.7.0; advancing a customer code C-0005 would give another customer or a code not in the options). Dragging with Ctrl / ⌘ held swaps this (a single number increases by 1).
| Original values | Default | Series continuation |
|---|---|---|
1 | Copy | 2, 3, 4 … (Ctrl / ⌘) |
1, 3 | Series | 5, 7, 9 … (two or more use a least-squares line) |
'1.50', '1.75' (strings) | Series | '2.00', '2.25' … (stay strings; decimal places match the most in the originals) |
2026-11-02 | Series | 2026-11-03, 2026-11-04 … (keeps the format) |
2026-01-15, 2026-02-15 | Series | 2026-03-15, 2026-04-15 … (monthly when the day is the same) |
月 / Mon / 1月 / Jan | Series | 火, 水 … / Tue, Wed … / 2月, 3月 … (wraps around) |
LOT-001 | Series | LOT-002, LOT-003 … (keeps the zero-padding width) |
09:00 (a time editor column) | Series | 10:00, 11:00 … (one value goes by 1 hour; two or more follow a line in minutes, 09:00, 09:15 → 09:30; wraps within 0:00–23:59. Since 1.11.0) |
2026-12-02T09:00 (a datetime editor column) | Series | 2026-12-03T09:00 … (one value goes by 1 day; when times match, the same rules as dates, otherwise a line in minutes. Since 1.11.0) |
Cutting, Grinding, Inspection | Copy | — |
| Values including empty cells | Copy | — (dragging from empty cells empties the range) |
Dragging up / left continues in reverse (1, 2, 3 dragged up gives 0, -1 …. With one original value it goes back by 1, and above 2026-11-02 is 2026-11-01).
Details
- Skipped: label / group rows (not counted as positions either), the synthetic row drag / detail toggle / auto group columns, and the total row. While filtered / sorted, cells are filled in display order and hidden rows aren't written. No rows are added past the end of the table.
- Writing: as with paste, cells that can't be edited (
readOnly/editable: false/canEditCell) are skipped. clientSide passes it toonRowsChangeonce, and it's covered by undo / redo. Values keep their type. - The button after filling: it disappears when the selection changes, a cell value changes from outside, columns change, sorting / filtering / group open state changes, or editing starts. When fill kinds are mixed across columns, choosing "Fill Series" makes every column a series (values without a continuation stay copies). With no values that can form a series, "Fill Series" can't be chosen. When there's no room at the bottom right (it would hit the table's bottom edge, the total row or the bottom of the visible area), it appears above the corner.
- Double-click: double-click the visible square of the handle. It stops before cells in the filled column that already have values, label / group rows, and rows not yet loaded, and doesn't overwrite existing values.
- serverSide: it writes back through
dataSource.updateRows(optimistic updates and rollback on failure are the same as editing). Rows not loaded aren't written, and columns / rows whose original range includes rows not loaded aren't filled. There is no undo / redo. Choosing again with the button writes over the rows as they are at that time, so cells that the re-choice doesn't write because of avalidatereject keep the value from the first fill. - Keyboard: the handle is a pointer-only part (hidden from assistive technology). With the keyboard, copy / paste does the same. In the button's menu, ↑ / ↓ move, and
Escape/Tabclose.
Changing the look
| Target | Class / CSS variable |
|---|---|
| Handle | .ssg-fill-handle (color --ssg-accent, outline --ssg-fill-handle-ring) |
| Dotted line of the range to fill | .ssg-fill-preview (color --ssg-fill-line; default is the text color) |
| Root while dragging | .ssg-root--filling |
| Button / menu after filling | .ssg-fill-options / .ssg-menu-panel.ssg-fill-menu |
| Value tooltip | .ssg-tooltip.ssg-fill-tooltip |
Full details are in "Fill handle" in the API reference.
Diff view
With the baseline of trackChanges, compare a previous version of the rows with the current rows and color changed cells, added rows and removed rows. Step through changes with the counts and ▲ ▼ in the bottom bar
Row drag
Grab the handle with enableRowDrag to move rows up and down (a new array through onRowsChange, undoable)