Getting started
FreeGrid is a framework-free TypeScript grid with thin React, Vue, Svelte and Angular wrappers. Install the core package, or the wrapper for your…
Live demo100,000 rows
Row and column virtualization keeps 100k × 50 smooth.
Code for this demo
import { createGrid } from '@freegridjs/core';
import { demoColumns, makeRows } from '../data';
import { button, separator, text, tr, type DemoContext } from '../ui';
export default function mount(ctx: DemoContext) {
const { lang } = ctx;
// 100,000 rows × 50 columns (12 base + 38 extra metric columns)
const rows = makeRows(100_000, 38);
const t0 = performance.now();
const grid = createGrid(ctx.host, {
columns: demoColumns(lang, 38),
data: rows,
rowSelection: 'multiple',
locale: lang,
});
const ms = performance.now() - t0;
text(ctx, tr(lang, {
en: `${rows.length.toLocaleString()} rows × 50 columns rendered in ${ms.toFixed(0)} ms`,
ko: `${rows.length.toLocaleString()}행 × 50열을 ${ms.toFixed(0)}ms에 렌더링`,
}));
separator(ctx);
button(ctx, tr(lang, { en: 'Jump to row 50,000', ko: '50,000번째 행으로' }), () => grid.scrollToRow(49_999));
button(ctx, tr(lang, { en: 'Jump to the end', ko: '맨 끝으로' }), () => grid.scrollToRow(rows.length - 1));
button(ctx, tr(lang, { en: 'Sort by total', ko: '합계로 정렬' }), () => {
const s = performance.now();
grid.setSort([{ colId: 'total', dir: 'desc' }]);
ctx.log(tr(lang, { en: 'sorted 100,000 rows in', ko: '10만 행 정렬 시간' }) + ` ${(performance.now() - s).toFixed(0)} ms`);
});
return grid;
}FreeGrid is a framework-free TypeScript grid with thin React, Vue, Svelte and Angular wrappers. Install the core package, or the wrapper for your framework.
npm i @freegridjs/core
# React
npm i @freegridjs/core @freegridjs/react
# Vue
npm i @freegridjs/core @freegridjs/vue
# Svelte
npm i @freegridjs/core @freegridjs/svelte
# Angular
npm i @freegridjs/core @freegridjs/angularGive the grid a container with a height, import the stylesheet once, and pass columns and rows. Only the rows on screen are rendered, so the data size barely matters.
import { createGrid } from '@freegridjs/core';
import '@freegridjs/core/styles.css';
const grid = createGrid(document.getElementById('grid'), {
columns: [
{ field: 'name', header: 'Name', pinned: 'left' },
{ field: 'country', header: 'Country', filter: 'set' },
{ field: 'joined', header: 'Joined', type: 'date' },
{ field: 'total', header: 'Total', type: 'number', format: '#,##0' },
],
data: rows,
});Use it from a CDN
No build step? Load the bundle from npm through unpkg with a script tag. It exposes a global FreeGrid and includes all fourteen languages. @1 follows the newest 1.x release; pin an exact version such as @freegridjs/[email protected] in production. The same files are on jsDelivr: replace unpkg.com with cdn.jsdelivr.net/npm.
<link rel="stylesheet" href="https://unpkg.com/@freegridjs/core@1/dist/cdn/freegrid.css">
<script src="https://unpkg.com/@freegridjs/core@1/dist/cdn/freegrid.min.js"></script>
<div id="grid" style="height: 480px"></div>
<script>
const grid = FreeGrid.createGrid(document.getElementById('grid'), {
columns: [{ field: 'name' }, { field: 'total', type: 'number', format: '#,##0' }],
data: [{ name: 'Kim', total: 1200 }, { name: 'Lee', total: 3400 }],
locale: 'ko', // all 14 languages are bundled
});
</script><link rel="stylesheet" href="https://unpkg.com/@freegridjs/core@1/dist/cdn/freegrid.css">
<div id="grid" style="height: 480px"></div>
<script type="module">
import { createGrid } from 'https://unpkg.com/@freegridjs/core@1/dist/cdn/freegrid.esm.js';
createGrid(document.getElementById('grid'), { columns, data });
</script>Questions about this page
How do I install FreeGrid?
Run npm i @freegridjs/core, import createGrid and the stylesheet, and call createGrid(element, { columns, data }) on an element with a height. Without a build step, load freegrid.min.js and freegrid.css from a CDN.
Does FreeGrid need React, Vue or another library?
No. The core has no dependencies and works with plain JavaScript; thin wrappers for React, Vue, Svelte and Angular are separate packages.