Skip to content

Installation

Terminal window
npm install next-grid-js
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.

Official adapters wrap next-grid-js/core with idiomatic props, events, and portal-mounted cell renderers/editors:

  • TypeScript moduleResolution: Supports 'bundler', 'node10', 'node16', and 'nodenext' for ES modules, and 'nodenext' for CommonJS files (TypeScript 5.8 or 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 browser HTMLElement. See Limits & Browser Support.

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' },
],
});
}

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;
}

Call grid.destroy() when removing the grid from the DOM to release pooled nodes, ResizeObserver, and event listeners:

grid.destroy();