Installation
Package Installation
Section titled “Package Installation”npm install next-grid-jsPackage Entries & Stylesheet
Section titled “Package Entries & Stylesheet”| Entry Point | Exports | Notes |
|---|---|---|
next-grid-js |
Full Grid + all types & helpers |
Includes ClipboardModule and ExportModule |
next-grid-js/core |
Core Grid + all types & helpers |
Lighter entry; pass optional modules via options.modules |
next-grid-js/export |
ExportModule |
Required for dataExport / exportData on ./core |
next-grid-js/clipboard |
ClipboardModule |
Required for clipboard / clipboard APIs on ./core |
next-grid-js/locale/ru |
ru |
Russian UI & ARIA dictionary (localeText: ru) |
next-grid-js/styles.css |
Base stylesheet | Must be imported once with any JS entry |
JavaScript entries do not automatically load CSS — import 'next-grid-js/styles.css' once in your application entry point (or styles in angular.json). See Entries & Modules.
Framework Adapter Packages
Section titled “Framework Adapter Packages”Official adapters wrap next-grid-js/core with idiomatic props, events, and portal-mounted cell renderers/editors:
- React (
next-grid-react) — React 18 & 19 - Vue (
next-grid-vue) — Vue 3.4+ - Svelte (
next-grid-svelte) — Svelte 5.46+ - Angular (
next-grid-angular) — Angular 21 & 22
TypeScript & SSR Requirements
Section titled “TypeScript & SSR Requirements”- TypeScript
moduleResolution: Supports'bundler','node10','node16', and'nodenext'for ES modules, and'nodenext'for CommonJS files (TypeScript5.8or later). - SSR: All package entries load safely in Node.js without a browser DOM, so server rendering never throws on import; only
new Grid(...)requires a mounted browserHTMLElement. See Limits & Browser Support.
Minimal Setup
Section titled “Minimal Setup”Import Grid and the default stylesheet, then instantiate new Grid<T>(options):
import { Grid } from 'next-grid-js';import type { ColumnDef } from 'next-grid-js';import 'next-grid-js/styles.css';
interface Order { id: string; customer: string; region: string; amount: number; status: 'Active' | 'Pending' | 'Refunded';}
const columnDefs: readonly ColumnDef<Order>[] = [ { key: 'id', name: 'ID', width: 100, pinned: 'start' }, { key: 'customer', name: 'Customer', width: 220, flex: 1 }, { key: 'region', name: 'Region', width: 130 }, { key: 'amount', name: 'Amount', width: 140, cellDataType: 'number', formatter: ({ value }) => `$${Number(value).toLocaleString('en-US')}`, }, { key: 'status', name: 'Status', width: 120 },];
const container = document.getElementById('grid');
if (container) { const grid = new Grid<Order>({ container, ariaLabel: 'Orders', defaultColDef: { isSortable: true, isFilterable: true, isResizable: true, }, columnDefs, getRowId: (row) => row.id, rowData: [ { id: 'ORD-1', customer: 'Acme Corp', region: 'EU-West', amount: 14280, status: 'Active' }, { id: 'ORD-2', customer: 'Northwind', region: 'US-East', amount: 8940, status: 'Pending' }, ], });}Container Sizing
Section titled “Container Sizing”The host container must have an explicit height (or flex/grid constrained height) so the internal viewport can calculate visible row counts:
#grid { width: 100%; height: 520px;}Teardown
Section titled “Teardown”Call grid.destroy() when removing the grid from the DOM to release pooled nodes, ResizeObserver, and event listeners:
grid.destroy();