Introduction
NextGrid (next-grid-js) is a framework-agnostic, high-performance TypeScript data grid with zero external runtime dependencies.
Its core invariant is simple: memory use and DOM size stay bounded by the visible viewport, regardless of whether your dataset has 50 rows or 1,000,000.
import { Grid, type ColumnDef, type GridRenderDiagnostics,} from 'next-grid-js';import { createMillionRowSource, type TelemetryRow,} from './data/telemetry';import { syncGridTheme } from './theme';import type { DemoMountContext } from './types';
export function mount({ stage, meta }: DemoMountContext): () => void { let lastFrameText = '';
const columnDefs: readonly ColumnDef<TelemetryRow>[] = [ { key: 'id', name: 'ID', width: 118, pinned: 'start', isMovable: false, }, { key: 'region', name: 'Region', width: 120, minWidth: 105, flex: 1, }, { key: 'uptime', name: 'Uptime', width: 110, minWidth: 95, flex: 1, cellDataType: 'number', formatter: ({ value }) => `${Number(value).toFixed(2)}%`, }, { key: 'latency', name: 'Latency', width: 110, minWidth: 95, flex: 1, cellDataType: 'number', formatter: ({ value }) => `${Number(value).toFixed(1)} ms`, }, { key: 'volume', name: 'Volume', width: 135, minWidth: 115, flex: 1.15, cellDataType: 'number', formatter: ({ value }) => `$${Number(value).toLocaleString('en-US')}`, }, { key: 'status', name: 'Status', width: 115, minWidth: 95, flex: 1, }, ];
const grid = new Grid<TelemetryRow>({ container: stage, columnDefs, rowSource: createMillionRowSource(1_000_000), rowOverscan: 6, columnOverscan: 2, diagnostics: { onFrame: (d: Readonly<GridRenderDiagnostics>) => { const text = `Rows: 1,000,000 · DOM rows: ${d.dom.activeRows} · ${d.renderDurationMs.toFixed(1)} ms`; if (text !== lastFrameText) { lastFrameText = text; meta.textContent = text; } }, }, }); const stopTheme = syncGridTheme(stage);
return () => { grid.destroy(); stopTheme(); };}Architectural Principles
Section titled “Architectural Principles”- DOM Recycling Pools: Row, cell, and header elements are acquired from fixed-size pools bounded by visible viewport dimensions plus
rowOverscan/columnOverscan. - Single Native Scroll Owner:
.grid-body-viewportis the only native horizontal and vertical scroll container. Pinned start/end headers and bodies synchronize through oneSurfaceCoordinatorpath. - Strict TypeScript: Full generics across
Grid<T>,ColumnDef<T>,GridOptions<T>,GridApi<T>, and typed event listeners (addEventListener). - Atomic State & Transactions: State updates, column mutations, cell edits, and row transactions validate before publication so failed operations never leave half-applied state.
- Error Containment: Isolated
valueGetterandformatterfailures render recoverable cell error states instead of crashing the grid.
Feature Overview
Section titled “Feature Overview”| Area | Capabilities | Guide |
|---|---|---|
| Virtualization | Vertical & horizontal DOM pooling, lazy/direct 1M+ row sources, rowHeight, variableRowHeights |
Virtualization |
| Columns & Layout | flex, minWidth/maxWidth, resizing, reordering, visibility, pinned: 'start' | 'end', logical rtl, nested columnGroups, columnMenu |
Columns & Layout |
| Data Processing | Multi-column sorting, typed & compound filters, quickFilter, pagination |
Sorting & Filtering |
| Interaction | Composite keyboard navigation root, single/multi row selection, checkboxes, cell range selection, customizable bodyMenu |
Selection & Editing |
| Editing & Mutation | Typed & custom cellEditor, valueParser/valueValidator/valueSetter, cellRenderer lifecycle, row transactions, undo/redo, TSV clipboard & fill |
Selection & Editing |
| Data Export | Async chunked export to CSV, JSON, Markdown, and zero-dependency lazy Excel (.xlsx) via footer, bodyMenu, or API |
Data Export |
| Hierarchy & Pivot | Client row grouping, path & nested tree data, custom aggregates, client & server-side pivot | Hierarchy & Pivot |
| Advanced Layout | Full-width rows, Master/Detail panels with nested child grids, pinned rows & projected totals, rectangular cell spans | Advanced Layout |
| Remote Models | infinite, serverSide (block cache, prefetch, cancellable retries), and live viewport push updates |
Remote Data |
| Customization & i18n | Scoped --next-grid-* tokens, theme: 'auto' | 'light' | 'dark', compact density, localeText (en, next-grid-js/locale/ru) |
Theming |
| Packaging & Modules | Full next-grid-js entry alongside tree-shakeable next-grid-js/core with per-instance ExportModule and ClipboardModule |
Entries & Modules |
| Framework Adapters | Official packages for React, Vue 3, Svelte 5, and Angular 21–22 over the same core | Frameworks |
What NextGrid Is Not
Section titled “What NextGrid Is Not”- Not a full-featured spreadsheet clone: NextGrid focuses on tabular data grids; formula engines, multi-sheet workbooks, and integrated charts are out of scope for the core grid.
- Not a built-in backend query engine: Remote
infinite/serverSide/viewportmodels delegate sorting, filtering, grouping, and full-dataset export to your backend. - Not a headless-only hook library: NextGrid owns its retained virtualized DOM pools and CSS layout geometry for deterministic performance.