Getting started
From installation to your first grid takes about five minutes. Follow this page and look up the other guides when you need them.
Installation
horee-grid is not published on the public npm registry. Keep the package file you receive with your purchase (horee-grid-version.tgz) inside your project and install it from there.
# after putting the file in your project's vendor folder
npm install ./vendor/horee-grid-0.0.1-beta.1.tgzpackage.json will then contain the following. To upgrade, replace the file and run the same command again.
"dependencies": {
"horee-grid": "file:vendor/horee-grid-0.0.1-beta.1.tgz"
}If the version number is the same, npm install alone does not pick up the new file. Run the npm install ./vendor/…tgz command above directly.
What the package contains:
| File | Contents |
|---|---|
dist/horee-grid.js | ES module (for bundlers such as Vite or webpack) |
dist/horee-grid.umd.cjs | UMD (via <script> or CommonJS) |
dist/horee-grid.css | Default styles |
dist/types/*.d.ts | TypeScript type definitions |
Your first grid
You need three things: an element with a height, column definitions and an array of rows.
<div id="grid" style="height: 400px"></div>import { createGrid } from 'horee-grid'
const grid = createGrid(host, {
locale: 'en',
columns: [
{ field: 'code', title: 'Code', width: 80 },
{ field: 'name', title: 'Item', flex: 1, minWidth: 160 },
{ field: 'qty', title: 'Qty', type: 'number', width: 90 },
{ field: 'price', title: 'Unit price', type: 'number', width: 110 },
{ field: 'day', title: 'Received', type: 'date', width: 110 }
],
rows: [
{ code: 'A001', name: 'Bolt M8', qty: 1200, price: 85, day: '2026-11-02' },
{ code: 'A002', name: 'Nut M8', qty: 1500, price: 40, day: '2026-11-02' },
{ code: 'B010', name: 'Bearing 6204', qty: 64, price: 5300, day: '2026-11-15' },
{ code: 'C120', name: 'Oil seal 35x52', qty: 210, price: 1250, day: '2026-11-21' }
],
rowKey: 'code'
})import { createGrid } from 'horee-grid'
import 'horee-grid/dist/horee-grid.css'
const grid = createGrid(document.getElementById('grid')!, { columns, rows, rowKey: 'code' })createGrid(element, options)returns aGridobject. From then on you work through its methods (grid.setRows(…),grid.getSelectedRows()…).- Rows are plain objects. A column's
fieldis the key in the object. rowKeyis the field that identifies a row. It keeps the selection and active cell when you reload rows, and it is whatselect(key)uses. You should always set it.- To show the grid's menus in English, add
locale: 'en'. See Languages.
In example code, host is the element that holds the grid and toolbar is the row of buttons above the example. Everything else runs exactly as shown.
Height
The grid fills the element you give it. If that element has no height, nothing is visible.
/* fixed height */
#grid { height: 400px; }
/* fill the remaining height of the screen (flex) */
.page { display: flex; flex-direction: column; height: 100vh; }
.page #grid { flex: 1; min-height: 0; }Inside flex or grid layouts, the container can grow to the total column width. Give the grid's element min-width: 0 so horizontal scrolling stays inside the grid.
Changing data, cleaning up
grid.setRows(newRows) // replace with new query results; selection of rows with the same rowKey is kept
grid.setColumns(newCols) // replace the column definitions
grid.refresh() // recalculate and redraw after changing row values from outside
grid.destroy() // when leaving the screen; removes all events and elementsUsing it in Vue
There is no official Vue component. The core does not know about frameworks, so a thin wrapper is enough. Do not wrap it on every screen; keep one shared component in your project.
<script setup lang="ts">
import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { createGrid, type ColumnDef, type Grid, type Row } from 'horee-grid'
import 'horee-grid/dist/horee-grid.css'
const props = defineProps<{ columns: ColumnDef[]; rows: Row[]; rowKey?: string }>()
const el = ref<HTMLDivElement>()
let grid: Grid | undefined
onMounted(() => {
grid = createGrid(el.value!, { columns: props.columns, rows: props.rows, rowKey: props.rowKey, locale: 'en' })
})
watch(() => props.rows, rows => grid?.setRows(rows))
watch(() => props.columns, cols => grid?.setColumns(cols))
onBeforeUnmount(() => grid?.destroy())
defineExpose({ grid: () => grid })
</script>
<template><div ref="el" style="height: 100%; min-width: 0" /></template>If rows lives inside reactive or ref, the grid receives proxy objects and slows down. Keep large lists in shallowRef or pass toRaw(rows).
Using it in React
import { useEffect, useRef } from 'react'
import { createGrid, type ColumnDef, type Grid, type Row } from 'horee-grid'
import 'horee-grid/dist/horee-grid.css'
export function HoreeGrid({ columns, rows, rowKey }: { columns: ColumnDef[]; rows: Row[]; rowKey?: string }) {
const el = useRef<HTMLDivElement>(null)
const grid = useRef<Grid>()
useEffect(() => {
grid.current = createGrid(el.current!, { columns, rows, rowKey, locale: 'en' })
return () => grid.current?.destroy()
}, []) // create only once
useEffect(() => grid.current?.setRows(rows), [rows])
useEffect(() => grid.current?.setColumns(columns), [columns])
return <div ref={el} style={{ height: '100%', minWidth: 0 }} />
}If event options (such as onCellChange) need to read the latest state, keep the callback in a useRef and pass that.
Using a script tag
On pages without a bundler, include the UMD file. The global name is HoreeGrid.
<link rel="stylesheet" href="/lib/horee-grid.css">
<script src="/lib/horee-grid.umd.cjs"></script>
<script>
const grid = HoreeGrid.createGrid(document.getElementById('grid'), { columns, rows, locale: 'en' })
</script>Adding the license key
Set it once when your app starts. Grids that already exist are checked again right away.
import { setLicenseKey } from 'horee-grid'
setLicenseKey(import.meta.env.VITE_HOREE_GRID_KEY)- Development addresses such as
localhostand127.0.0.1need no key. - Even without a key, or with a wrong one, the grid keeps working. A notice appears in the bottom-right corner and the reason is logged to the console once.
- See License key for details.
Next steps
| What you want to do | Where to look |
|---|---|
| Thousands separators, date formats, fixed columns, grouped headers | Columns |
| Edit cells and save | Editing |
| Paste from Excel, download as an Excel file | Copy · Paste · Excel |
| Lists with hundreds of thousands of rows | Server data |
| All options and methods | API |