Skip to content
Niko Table

Niko Grid Types

CellState, CellPosition, GridRow, and related TypeScript types.

These types live in grid/types/. They have no domain logic, so they are safe to copy with the registry item.

type CellStatus = "valid" | "invalid" | "empty"

Each editable cell keeps raw, the resolved value, and status apart. A pasted value that does not match stays visible, so the user can fix it.

interface CellState<T> {
raw: string
value: T | null
status: CellStatus
/** Tooltip when invalid. */
error?: string
}

A cell is addressed by row id and column id, not display index. Focus and selection then survive filter, sort, and reorder.

interface CellPosition {
rowId: string
columnId: string
}

The copy outline (marching ants). It is stored by id: Set membership plus the edge ids.

interface CopiedRange {
rowIds: Set<string>
firstRowId: string
lastRowId: string
columnIds: Set<string>
firstColumnId: string
lastColumnId: string
}

The selection rectangle, edges included, in display space (indices after filter and sort).

interface SelectionBounds {
minRow: number
maxRow: number
minColIndex: number
maxColIndex: number
}
interface GridRow {
id: string
[columnId: string]: CellState<string> | string
}
Helper Role
emptyCell<T>() Blank cell with status: "empty"
isCellInBounds Inclusive membership in selection bounds
Location Types
use-data-grid.ts UseDataGrid, UseDataGridConfig, GridCommit
use-grid-columns.ts GridColumnSpec, GridColumnsApi
use-grid-changes.ts GridChangeSet, GridChanges, GridReconcileResult
data-grid-columns-context.tsx GridColumnTypeOption
cell-props.ts CellEditorProps, GridComboboxOption

For table-level types, see Niko Table Types.