Data Grid

Virtualized table with resizable columns, selection, and optional cell editing.

Also known as: table, grid, spreadsheet, virtual table

Installation

Install with the CLI, or copy the component source into your project.

Add data-grid (npm)

npx --yes -p @default-file/ui df-ui add data-grid

Default

Virtualized table with resizable columns. Drag a header edge, or focus the resize handle and use arrows, Home, and End.

Title
Owner
Status
Points

Multi select

selectionMode multi adds a checkbox column. Click, Space, or Shift click to select, and use the header checkbox to toggle every row.

Title
Owner
Status
Points

Single select

selectionMode single keeps one selected row. Clicking a row replaces the selection, and there is no checkbox column.

Title
Owner
Status
Points

Cell editing

Click a title cell or press Enter to edit. The host stores the value, Enter and blur commit, and Escape closes the editor.

Title
Owner
Status
Points

Column state

Controlled column width and visibility. Resize Title, Owner, and Notes, keep Points fixed, and toggle Notes to hide or show it.

Notes column
Title
Owner
Status
Points

Loading

Placeholder rows while data is loading. The grid sets aria-busy.

Title
Owner
Status
Points

Empty

Custom empty content when there are no rows.

Title
Owner
Status
Points

No work items yet.

Properties

Virtualized data table with resizable columns, row selection, and optional cell editing.

DataGrid

PropTypeDefaultNotes
rowsDataGridRow<T>[]-Row models with id and data (required).
columnsDataGridColumnDef<T>[]-Column definitions (required).
columnStateDataGridColumnState[]-Controlled column width and visibility state.
defaultColumnStateDataGridColumnState[]-Uncontrolled initial column state.
onColumnStateChange(state: DataGridColumnState[]) => void-Called when column widths or visibility change.
selectionMode"none" | "single" | "multiple"-Row selection behavior.
selectedIdsstring[]-Controlled selected row ids.
defaultSelectedIdsstring[]-Uncontrolled initial selected row ids.
onSelectionChange(ids: string[]) => void-Called when selection changes.
loadingbooleanfalseShow loading placeholder rows.
emptyContentReactNode-Content when there are no rows.
overscannumber-Extra virtual rows rendered outside the viewport.
estimateRowSizenumber-Estimated row height in pixels for virtualization.
classNamestring-Additional styles on the root.

DataGridColumnDef

PropTypeDefaultNotes
idstring-Stable column id (required).
headerReactNode-Header cell content (required).
widthnumber-Initial width in pixels.
minWidthnumber-Lower bound for resize. Defaults to --df-data-grid-col-min-width.
maxWidthnumber-Upper bound for resize. Defaults to --df-data-grid-col-max-width.
resizableboolean-When true, the column can be resized.
hiddenboolean-When true, the column is omitted from the grid.
cell(row: DataGridRow<T>) => ReactNode-Render function for the body cell (required).
editCell(row, commit) => ReactNode-Optional editor for the cell.