Skip to content

Data grid

Pro

Spreadsheet-style editing, virtualized both ways, with typed editors, validation, keyboard ranges, and copy and paste. Not an M3 component (@windmorph/react-pro).

import { DataGrid } from '@windmorph/react-pro/data-grid';

Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.

Keyboard

Data grid keyboard
KeyAction
TabMoves into and out of the grid, which is one tab stop.
Arrow keysMove between cells, including headers and row headers.
Page Up or Page DownMove by a screenful of rows.
Home or EndMove to the row’s start or end.
Ctrl + Home or Ctrl + EndMove to the grid’s first or last cell.
Shift + Arrow keysExtends the selected range.
Enter or F2Edits the cell; on a row header, moves to its controls.
Enter or TabCommits and moves down or across.While editing
EscapeCancels an edit, or clears the range.
Delete or BackspaceClears the selected cells.
Ctrl + ASelects every cell.
Ctrl + C or Ctrl + VCopy and paste as tab-separated text.
  • Typing starts an edit with the key typed.
  • Left and Right mirror in right to left.

Screen reader

Role
A grid with row, columnheader, rowheader and gridcell, with aria-rowindex and aria-colindex on each.
Accessible name
From aria-label or aria-labelledby, which the types require.
States announced
aria-rowcount and aria-colcount carry the true size. Cells expose aria-selected, aria-invalid and aria-readonly, and an invalid cell is described by its message.
  • A cell’s state is an icon named by its label, so colour is never alone.
  • Validation messages and pastes are announced in a polite live region.

Focus

  • The active cell keeps focus and the tab stop when it scrolls out of the rendered window.
  • If rows or columns shrink under it, the active cell moves to one that exists.
  • A finished edit returns focus to the cell, or the next one.

Touch target

  • Rows are 48px tall at density 0 and lose 4px a density step.
  • Editing happens in a field that fills the cell.

Motion

None. Nothing in the grid moves; its rows scroll with the page’s own scrolling.

What you need to do

  • Give the grid a name, and every column a non-empty header.
  • Set a validate message that says how to put the value right.
  • Give every state from getCellState a label.
  • Keep rows and onCellChange in step: the grid holds no data of its own.