Data grid
ProSpreadsheet-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.
Purpose
Edit records cell by cell, as in a spreadsheet, across rows and columns virtualized both ways. Import it from @windmorph/react-pro/data-grid, with @tanstack/react-virtual installed. To browse and act on rows instead, use a DataTable.
Behaviour
- One tab stop: arrows, Page Up, Page Down, Home, End and Ctrl + Home or End move, and the active cell stays mounted when it scrolls away.
- Enter, F2 or typing edits. Enter and Tab commit and move, Escape cancels, and Delete clears the range.
validatereturns a message. The cell keeps what was typed, is marked invalid with an icon as well as colour, and shows the message below the grid;onCellChangeisn't called.- Editors are
text,number(withminandmax),selectandcustom, on each column'seditor. - Shift with movement, or a mouse drag, selects a range. Copy and paste use tab-separated text, so they work with spreadsheets;
onPastecan reject or adjust a paste. getCellStategives a cell a semantic state with a label, so colour is never alone.summaryRowsare the app's: the grid never computes totals.- Rows and columns are placed from the
row-height,header-heightandrow-header-widthtokens, and follow a change to them, a theme switch or density.
When not to use
To browse and act on rows use a DataTable.
See also
- Data table: Browse, sort, filter, select and act on records, from the browser or a server, with saved views and a compact form. Not an M3 component (@windmorph/react-pro).
- Text field: Filled or outlined text input with a floating label, icons, affixes, counter, error icon and a text area.