SpreadsheetGrid
Guides

Keyboard and touch

Key bindings for the grid and its editors, and touch gestures on phones and tablets

These keys work while the grid itself has focus (not while editing). They are off while a form element such as a filter input has focus.

The grid

KeyAction
Arrows (+ Shift to extend the range) / Tab / Shift+TabMove the active cell (Tab on the last column / Shift+Tab on the first column moves focus to the next / previous element outside the grid. Buttons inside the grid, such as the ⋮ in column headers, are not in the Tab order, so one Tab enters or leaves the grid. Open the column menu with Alt+↓. Tab on the last column also skips buttons you place with renderCell or a label row's render; reach them by clicking or with Shift+Tab from after the grid. For detail row cards, see the note below)
Ctrl/Cmd+Arrow (+ Shift)To the last row / column in that direction (the edge of the table; it does not stop at gaps in the values)
Home / End (+ Shift)To the first / last column of the row
Ctrl/Cmd+Home / Ctrl/Cmd+End (+ Shift)To the first / last cell
PageUp / PageDown (+ Shift)Up / down by one visible screen of rows
Alt+↓ (Option+↓ on Mac)Open the column menu of the active cell's column (with enableColumnMenu; focus goes to the first item. Inside the menu, ↓ / ↑ / Home / End move, Enter / Space run, Escape / Tab close. "Pin column" opens its submenu with → / Enter / Space and focuses its first item; ← in the submenu closes it and goes back. For a column inside a collapsible column group (columnGroups), the top item is "Close …" / "Open …")
Shift+F10 / Menu keyOpen the context menu of the active cell (with enableContextMenu; see "Context menu" below. Since 1.1.0)
Alt+Shift+↓ / Alt+Shift+↑ (Option on Mac)On a cell of the tree column in tree data, open / close that row (since 1.9.0. In other columns, the same range extension as Shift+↓ / ↑)
Enter / F2 / typing a printable keyStart editing (a printable key becomes the initial value. A date column opens a text input and reads the text as a date when you commit)
EscapeClear the selection (with just one cell selected, nothing visibly changes. Inside a dialog, see "A grid inside a dialog" below)
Ctrl/Cmd+CCopy the selection as TSV (with no range selected, for example after clearing it with Escape, the active cell alone. Since 1.3.0. With isRowExportable, rows returning false are left out. Cells with line breaks are wrapped in "…" as in Excel. If the last row has only empty cells, a trailing line break is added, the same shape as Excel. The row drag handle column, detail toggle column and auto group column are not included)
Ctrl/Cmd+VPaste from the top-left of the selection (from the active cell with no range; a column selection pastes from the column's first data row. A no-op with readOnly. Ranges with in-cell line breaks or blank rows from Excel / spreadsheets paste as is)
Ctrl/Cmd+XCut (since 1.10.0, on by default). See "Excel keys" below
Ctrl/Cmd+ASelect all (press again to clear)
Delete / BackspaceClear the selected cells (cells that can't be edited are skipped)
Ctrl/Cmd+Z / Ctrl/Cmd+Shift+Z / Ctrl/Cmd+YUndo / redo
  • Last row / column: label rows are skipped. The first column is the first one after the row drag handle column and the detail toggle column (← can still move into them).
  • Extending with Shift: moves the end of the current range (ranges you selected by dragging the mouse or with Shift+click extend as is).
  • When there is no active cell (right after entering the grid with Tab, for example): the first arrow / Tab / Enter / PageUp / PageDown stops on the first cell (it does not start editing).
  • Page scrolling: when you move the active cell with the keyboard, the scrolling parents and the page around the grid also scroll as little as needed to show it (for example when the bottom of the grid is outside the window. Since 1.0.2). Clicking with the mouse does not move the page.
  • Detail row cards: inputs and buttons in a card join the Tab order so they work with the keyboard. Tab on the last column enters the card's first input (or similar) if that row's card is open, and Tab on the card's last element leaves the grid (it doesn't pass through other rows' cards). Shift+Tab goes the other way: from the card's first element back to the row's last cell, and coming back from after the grid it enters the last element of the active row's card. While a card is open, Tab on the last column leaves the grid without stopping on buttons in cells (renderCell). If you don't want Tab to stop on something in the card, give it tabIndex={-1}. If the card closes while focus is inside it (pressing the card's close button = collapse(), closing it through the handle, and so on), focus goes back to that row's cell (scrolling if it is out of view).
  • Mouse: Shift+clicking a cell selects from the anchor of the current range (or the active cell) to the clicked cell. Row numbers work the same: Shift+clicking a row number selects from the anchor of the current row range (or the active cell's row) to the clicked row.

Inside an editor

KeyAction
EnterCommit and move down (change the direction with editorEnterMove)
Alt+Enter / Ctrl+Enter / ⌘+EnterNew line in a multiline text editor (editor: { type: 'text', multiline: true }). In columns with enterKey: 'newline', Enter adds a new line and Ctrl+Enter / ⌘+Enter commits
Tab / Shift+TabCommit and move right / left
Ctrl+Enter / ⌘+Enter (tables with excelShortcuts)Write the same value to every cell in the selected range and commit (fill the selection. Since 1.10.0; see "Excel keys" below)
EscapeCancel
Focus leavesCommit (the select editor alone cancels; a select with allowFreeText commits the typed text)
PageUp / PageDownNothing (the grid does not scroll). In the select editor, moves through the options 8 at a time. Inside a multiline text editor, scroll with the wheel or arrows / Ctrl+Home / Ctrl+End
Home / EndMove the caret in text / number. In select, the first / last option (in a select with search, moves the caret in its input); in date, nothing (none of them scroll the grid)

Committing without changing the value (F2 → Enter, for example) writes nothing (it doesn't call onRowsChange or add to the undo history).

After a commit or cancel with Enter / Tab / Escape, focus returns to the grid (to the input catcher with imeDirectInput). When focus leaving the editor commits it, and focus moved to an element outside the grid (an input in a form above the grid, the global filter in the top bar, and so on), focus stays there; the grid doesn't take it back. So clicking a form input while editing commits the cell and lets you type straight into the input. Clicking another cell in the grid, or blank space that takes no focus, returns focus to the grid. Clicking another cell in the grid while editing commits the value and moves to the clicked cell (keep dragging for a range; on a row or column header, it selects the row or column).

Change where Enter moves after a commit with the editorEnterMove prop ('down' (default) / 'up' / 'right' / 'left' / 'none', like Excel's "After pressing Enter, move selection" option. It doesn't affect Tab / Shift+Tab).

The target after a commit is clamped to the row count "after the re-render that applies the commit". So with the usual entry-grid pattern of appending an empty row in onRowsChange, committing the last row with Enter moves straight into the new row.

Excel keys (excelShortcuts)

Cut, copy down / right, fill the selection, today's date, and selecting a row / column with the same keys as Excel (since 1.10.0). Only cut (Ctrl/Cmd+X) works by default; the other six work only in tables that set excelShortcuts (tables that don't set it keep their key behavior).

Rows 6 of 6Columns 5 of 5Sort: —
#
1
2
3
4
5
6
Rows 6 of 6Columns 5 of 5
Cell —Range —0 cells / 0 rows0 columns
  • Select the "Sato" cell in the Owner column and the 3 rows below it, then press Ctrl+D (⌘D on Mac) to copy the first value down. With a single row selected, it copies the row above.
  • Press Ctrl+; in a date cell for today's date. Select a range, start typing "In progress" and press Ctrl+Enter to write the same value to every cell in the range.
  • Cut a range with Ctrl+X and paste it elsewhere with Ctrl+V: the original cells become empty (one undo restores both).
<SpreadsheetGrid excelShortcuts />                      // all seven
<SpreadsheetGrid excelShortcuts={{ fillDown: false }} /> // all but Ctrl+D (leave it to the browser's bookmark)
<SpreadsheetGrid excelShortcuts={false} />               // turn off cut too (same as up to 1.9)
KeyNameBehavior
Ctrl / ⌘+XcutCopies the selected range and marks it with a dotted line (the values don't change yet). Pasting the same text into this grid clears the original cells together with the paste (one change). If the dotted line is gone, an original cell's value changed, or you paste different text, it is a normal paste (the originals stay). Pasting into another app works like a copy. On by default
Ctrl / ⌘+DfillDownCopy down. With 2 or more rows selected, copies the first row into the rest; with one row, copies the row above
Ctrl / ⌘+RfillRightCopy right. With 2 or more columns selected, copies the leftmost column into the rest; with one column, copies the column to the left (read by the target column's parser)
Ctrl+Enter (⌘+Enter on Mac; inside the editor)fillSelectionFill the selection. Select a range, start typing, and the same value is written to every cell in the range (the selection stays and doesn't move). In a multiline text editor it stays a new line
Ctrl / ⌘+;todayToday's date in the active cell (YYYY-MM-DD. Only the active cell even with a range selected, as in Excel). Not written to number, checkbox or select columns. Does nothing while editing
Shift+SpaceselectRowSelect the whole rows of the selection (the same range selection as clicking the row numbers; row selection checkboxes don't change)
Ctrl+SpaceselectColumnSelect the whole columns of the selection (Ctrl on Mac too)
  • Writing follows the same rules as pasting (cells that can't be edited, label rows and group rows are skipped, and columns with validationMode: 'reject' don't write values that fail validation). One key press is one change (one onRowsChange, one undo).
  • Ctrl+D / Ctrl+R / Ctrl+; also work in the entry row and write to the draft (Ctrl+D copies from the last data row, Ctrl+R from the draft's column to the left).
  • Ctrl / ⌘+D is the browser's bookmark key and Ctrl / ⌘+R its reload key. The grid takes them only when it has focus and the key is on for that table (set the keys you want to leave to the browser to false). Ctrl+Space may be taken by the IME or input source switching, and then it never reaches the page.
  • In /lite, cut is in the core and the other six work only when you add excelShortcutsFeature (Choose the features you bundle).
  • Tables that handled Ctrl+X / Ctrl+D and so on themselves up to 1.9 now run both the grid's handling and their own (Ctrl+X even without excelShortcuts). Keys the grid took have event.defaultPrevented set to true, so have your handler check that and stop, or remove it (to turn off cut, excelShortcuts={{ cut: false }}).

A grid inside a dialog

When the grid is inside a modal (Radix / Headless UI / Mantine / HeroUI Modal / Dialog, or a plain <dialog>), an Escape the grid uses (canceling an edit, closing the grid's menus and popovers, clearing a range selection, removing the copy range's dotted line, canceling a row / column / fill handle drag) does not close the dialog. Press Escape again (with just one cell selected) and it reaches the dialog, which closes. Escape in places the grid doesn't use, such as the top bar's input, also goes straight to the dialog.

While it is shown, the grid listens for Escape in the window's capture phase and calls preventDefault() only on the ones it uses (it tells Mantine's Modal with the element's data-mantine-stop-propagation, and modals that close on React events by stopping propagation at the grid root). A dialog that closes from a listener attached to the window's capture phase before the grid's (another dialog opened after the grid, for example) may close first.

Popups such as the column menu and filters open inside the dialog around the grid (since 1.1.0). How the place to draw them is chosen and how to change it (popupContainer) is in Use it inside a dialog.

IME (Japanese input)

Enter / Escape / Tab during IME composition (isComposing) are treated only as IME operations and are not used to commit or cancel a cell edit. The Enter that confirms a conversion never commits the cell by mistake.

Start typing with the IME on (imeDirectInput)

By default, if you start typing Japanese with the IME on in a cell that isn't being edited, the conversion doesn't start and the first input is lost (it's fine once you start editing with F2 / Enter / a double-click). With imeDirectInput, you can start typing Japanese with the cell just selected, as in Excel / SPREAD.

<SpreadsheetGrid rows={rows} columns={columns} onRowsChange={setRows} imeDirectInput />
  1. With a cell selected, type Japanese: the text being converted shows over the cell.
  2. Confirm the conversion (Enter) and editing starts with the confirmed text. You can keep typing.
  3. Press Enter again to commit the cell and move down.

It applies to editable cells with the text and number editors. In number columns, full-width digits you confirm are converted to half-width when editing starts ("12.5" → 12.5; conversions that aren't numbers are dropped). For custom editor columns, add imeDirectInput: true to the editor definition and the confirmed text opens in ctx.initialText (since 1.2.0; the editor uses initialText as its input's initial value). Select columns with search (since 1.7.0) open with the list filtered by the confirmed text (Searchable select editor). time / datetime / calendar date (picker: 'calendar') columns open with the confirmed text as what you started typing ("午後3時" (3 PM) → 15:00), and multi-select columns open the list filtered by the confirmed text if they have search, or highlight the option found by that text if not (all since 1.11.0). Single selects without search, date columns using the browser's date input, and custom columns without the flag still take nothing, as before. It's off by default because, while on, document.activeElement is an input whenever the grid has focus, so app shortcuts that ignore key presses in inputs stop working. Try it with the imeDirectInput switch in the playground. Details are in props.

Label rows (with labelRow)

KeyAction
↑ / ↓Don't stop on label (heading) rows; skip to the next data row in the same direction
Enter (commit an edit)The up / down move after a commit (editorEnterMove) also skips label rows and goes to the next data row
PasteSkips label rows and keeps pasting into the next data rows (no rows are lost)

Group rows and detail rows

KeyAction
Enter / Space (group row)Open / close the group
Enter / Space (cell of the detail toggle column)Open / close the detail row (does nothing on rows that can't open)

Pagination (pagination)

There is no key to change pages. Tab moves to the pager buttons (‹ page numbers ›) and the rows-per-page choice, and Enter / Space presses them. Arrow keys, PageUp / PageDown and Ctrl+Home / Ctrl+End move within the current page. When ‹ / › takes you to the first or last page and that button can't be pressed anymore, focus moves to the current page's number button (Pagination).

Context menu

KeyAction
↓ / ↑Move between items (skipping disabled ones and wrapping at the ends. Right after opening, ↓ goes to the first and ↑ to the last)
Home / EndTo the first / last item
Enter / SpaceRun the item
Escape / TabClose and return to the grid

Besides a right-click, the menu also opens with Shift+F10 / the Menu key (the application key on Windows) on the active cell (since 1.1.0). A menu opened from the keyboard appears at the bottom left of the cell, with focus on its first item. If getContextMenuItems returns no items (including when there is no active cell), the browser's own menu stays. The row number menu doesn't open from the keyboard.

Column filter popover

KeyAction
Enter (in an input)Apply (in a set filter's search box, selects only the matching values and closes)
EscapeClose (wherever focus is: an input, a checkbox in the list, a button. With a date calendar open, closes only the calendar. During IME composition, cancels the conversion)
Tab / Shift+TabNext / previous control in the popover (after the last comes the first; focus doesn't leave the popover)

Screen readers

The table is exposed as a WAI-ARIA grid. When you move the active cell with the arrow keys, assistive technology reads that cell (column header, row number, value). When you put several grids on one screen, name each table with ariaLabel.

<SpreadsheetGrid ariaLabel="Orders" rows={rows} columns={columns} />

The list of roles and attributes is in the API reference; operations only possible with a pointer and what to take care of in your app are in Accessibility.

Touch (phones and tablets)

On touch devices (pointerType === 'touch'), dragging is left to the browser's scrolling. The mouse behavior "start selecting on press → extend the range by dragging" doesn't apply; a tap selects.

GestureBehavior
Tap a cellActive cell + single-cell selection
Tap the same cell twice quickly (within 300ms)Start editing (like a double-click; works even in browsers that don't fire dblclick)
SwipeScroll vertically and horizontally (it doesn't select a range)
Tap a row numberSelect the whole row (a checkbox row selection with enableRowSelection)
Tap a column headerSelect the whole column
Tap ⋮ in a column headerColumn menu (filter / sort / pin / show…). On touch devices ⋮ is always shown. When you open a column filter, focus doesn't go to its input (so the on-screen keyboard doesn't cover the list of values); tap the input to type

Notes:

  • Range selection (several cells) isn't available with touch. Shift+tap sorting isn't available either, since there are no modifier keys (use the column menu).
  • Column resizing (the handle at the border) and column reordering (the grip) can be dragged with touch too, but the handles are small, so they're secondary. In headers narrower than 120px, if there is a ⋮, the grip is hidden and only ⋮ shows (to keep the header text. Since 1.0.2; tables without a column menu still show the grip). Reorder narrow columns in the tool panel's Columns tab.
  • On devices where touch is the main input (pointer: coarse), the text in the column filter, tool panel, top bar search box, find in cells and AI bar inputs is 16px or larger, like the cell editors (so iOS doesn't zoom the page when an input gets focus. Since 1.0.2).
  • On devices where touch is the main input (pointer: coarse), finger targets are larger (since 1.2.0): context menu / column menu items and select editor options are 44px tall; column filter options (checkbox rows), (Select all), the tool panel's column rows and visibility toggles, "Reset" and popover buttons are at least 40px tall; the tool panel's tabs, date inputs, calendar days, previous / next month and "Today" / "Clear" are 36px tall; and the column filter section's "Clear", date presets and date tree toggles are at least 32px (the calendar button in date inputs is 40px wide, and the two inputs of a date range stack vertically). The header ⋮, the popover × and the "Show / hide all columns" checkbox in the tool panel's Columns tab keep their look and only get a larger hit area. Nothing changes on mouse devices.
  • The cell context menu (right-click) doesn't support long-press on touch (it opens in environments where the browser fires contextmenu on long-press).
  • The grid root has touch-action: manipulation, so double taps on cells aren't taken by the browser's zoom (panning and pinch zoom still work).

Try the demos in Cell editing or Sorting and filtering.

On this page