Skip to content

Handsontable ships TypeScript declarations for its entire public API. This page lists every type you can import and shows how to use them in common scenarios.

Entry points

Handsontable exposes types from two entry points. Both give you the same types, so pick the one that matches how you import the library.

Full package — all modules pre-registered, no tree shaking:

import Handsontable, { GridSettings, HotInstance } from 'handsontable';

Base package — use when you import only the modules you need:

import Handsontable, { GridSettings, HotInstance } from 'handsontable/base';

TypeScript import type also works for any of the types below, and produces no runtime output:

import type { GridSettings, HotInstance } from 'handsontable';

Type reference

Configuration types

These types describe the settings object you pass to new Handsontable() or updateSettings().

TypeDescription
GridSettingsAll Handsontable configuration options. Use for the top-level settings object.
ColumnSettingsPer-column overrides. Each entry in the columns array uses this type.
CellPropertiesMerged cell-level settings after cascading from global → column → cell. Read-only at render time.
CellMetaMutable per-cell metadata stored in hot.getCellMeta(). Extends CellProperties.
EventsAll hook callback signatures, keyed by hook name. Use to type individual hook functions.
import type { GridSettings, ColumnSettings } from 'handsontable';
const columns: ColumnSettings[] = [
{ data: 'name', type: 'text' },
{ data: 'revenue', type: 'numeric', numericFormat: { pattern: '$0,0.00' } },
];
const settings: GridSettings = {
data: myData,
columns,
licenseKey: 'non-commercial-and-evaluation',
};

Data types

These types describe the values that move in and out of the grid.

TypeDescription
CellValueA single cell value: string | number | boolean | null | undefined.
CellChangeA single change tuple: [row, column, oldValue, newValue]. Passed to afterChange and beforeChange.
RowObjectA data row as a plain object, used when data is an array of objects.
ChangeSourceA string union of all built-in change source identifiers (e.g. 'edit', 'loadData', 'UndoRedo.undo').
SourceRowDataA row from the original source data before any index translation.
NumericFormatOptionsOptions for the numericFormat column setting (delegates to the Numbro library).
SelectOptionsObjectAn option entry for the select and autocomplete cell types: { value, label }.
RangeTypeA cell range descriptor: { from: CellCoords, to: CellCoords }.
import type { CellChange, ChangeSource } from 'handsontable';
function onAfterChange(changes: CellChange[] | null, source: ChangeSource): void {
if (!changes || source === 'loadData') return;
for (const [row, col, , newValue] of changes) {
console.log(`Cell [${row}, ${col}] changed to`, newValue);
}
}

Instance type

TypeDescription
HotInstanceThe Handsontable instance returned by new Handsontable(). Use to type refs and parameters that accept a live instance.
import Handsontable from 'handsontable';
import type { HotInstance } from 'handsontable';
let hot: HotInstance;
hot = new Handsontable(document.querySelector('#grid')!, {
data: myData,
licenseKey: 'non-commercial-and-evaluation',
});

Geometry classes

CellCoords and CellRange are runtime classes (not type-only) that you can also use as type annotations.

ExportKindDescription
CellCoordsClassA { row, col } coordinate pair. Returned by selection and navigation APIs.
CellRangeClassA { from: CellCoords, to: CellCoords } range. Returned by getSelectedRange().
IndexMapperClassThe row or column index translator. Typed access to hot.rowIndexMapper and hot.columnIndexMapper.
RangeTypeTypeA plain-object range descriptor accepted by APIs that don’t require a CellRange instance.
import { CellRange } from 'handsontable';
function logSelection(ranges: CellRange[]): void {
for (const range of ranges) {
console.log(`from [${range.from.row}, ${range.from.col}] to [${range.to.row}, ${range.to.col}]`);
}
}

Cell function registry types

Use these string-union types to constrain type, renderer, editor, and validator settings to registered names only.

TypeDescription
CellTypeUnion of all registered cell type aliases: 'text' | 'numeric' | 'checkbox' | ....
EditorTypeUnion of all registered editor aliases.
RendererTypeUnion of all registered renderer aliases.
ValidatorTypeUnion of all registered validator aliases.
import type { ColumnSettings, CellType } from 'handsontable';
function buildColumn(type: CellType): ColumnSettings {
return { type };
}

Editor base type

TypeDescription
BaseEditorInstanceThe BaseEditor class type. Use to type parameters and return values in custom editor code.

Hooks registry type

TypeDescription
HooksRegistryDescribes the static Handsontable.hooks object (e.g. .getRegistered()). Useful when passing the hooks registry as a typed parameter.
import type { HooksRegistry } from 'handsontable';
function listHooks(hooks: HooksRegistry): string[] {
return hooks.getRegistered();
}

Theme types

These types are relevant when you use the theming API or build a custom theme.

TypeDescription
ThemeConfigThe full configuration object for registerTheme().
ThemeParamsConstructor parameters for creating a theme instance.
ThemeBuilderThe builder object returned by the theme factory.
ThemeColorScheme'light' | 'dark' | 'auto'.
ThemeColorsConfigColor token overrides within a theme config.
ThemeDensityConfigRow height and cell padding token overrides.
ThemeDensitySizesNumeric sizes within a density config entry.
ThemeIconsConfigIcon token overrides.
ThemeLightDarkValueA token value with separate light and dark variants.
ThemeSizingConfigFont and spacing token overrides.
ThemeTokenValueA single design token value.
ThemeTokensConfigThe full token map used inside a ThemeConfig.
BaseThemeThe base theme object extended by all built-in themes.

Overlay type

TypeDescription
OverlayTypeA string union of all Walkontable overlay identifiers: 'top' | 'bottom' | 'left' | 'right' | .... Useful in advanced rendering customizations.

Implicit typing of the public API

The types listed above are the ones you need to import explicitly when you want to annotate your own variables, parameters, or return values.

The rest of the public API — plugins, editors, renderers, validators, cell types, and the Handsontable class itself — carries its own TypeScript declarations automatically. You get full type safety and IDE autocomplete for these as a side-effect of importing the value, with no additional type import required.

// No type import needed -- ContextMenu is already fully typed.
import { ContextMenu } from 'handsontable/plugins';
// No type import needed -- AutocompleteEditor is already fully typed.
import { AutocompleteEditor } from 'handsontable/editors';
// No type import needed -- numericRenderer is already fully typed.
import { numericRenderer } from 'handsontable/renderers';
// No type import needed -- the Handsontable class and its instance methods are already fully typed.
import Handsontable from 'handsontable';
const hot = new Handsontable(container, { licenseKey: 'non-commercial-and-evaluation' });
hot.loadData(myData); // IDE autocomplete and type checking work here.

The explicit import type { ... } pattern from the type reference section is only necessary when you need a type as an annotation outside of where the value is already in scope.

Common patterns

Type the settings object

Annotate settings directly so TypeScript validates every option:

import type { GridSettings } from 'handsontable';
const settings: GridSettings = {
data: employees,
colHeaders: ['Name', 'Department', 'Hire date'],
columns: [
{ data: 'name' },
{ data: 'department' },
{ data: 'hireDate', type: 'date', dateFormat: 'YYYY-MM-DD' },
],
licenseKey: 'non-commercial-and-evaluation',
};

Type hook callbacks using Events

Events maps every hook name to its callback signature. Extract a specific callback type with Events[hookName]:

import type { Events } from 'handsontable';
const onAfterChange: Events['afterChange'] = (changes, source) => {
if (!changes) return;
console.log(source, changes);
};
hot.addHook('afterChange', onAfterChange);

Type a custom renderer

Custom renderers receive a typed CellProperties argument:

import Handsontable from 'handsontable';
import type { CellProperties, HotInstance, GridSettings } from 'handsontable';
function statusRenderer(
hotInstance: HotInstance,
TD: HTMLTableCellElement,
row: number,
col: number,
prop: string | number,
value: string,
cellProperties: CellProperties
): void {
Handsontable.renderers.TextRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
TD.style.color = value === 'Active' ? 'green' : 'red';
}

Type a custom editor

Extend BaseEditorInstance for full IDE support when writing custom editors:

import { BaseEditor } from 'handsontable/editors';
import type { GridSettings } from 'handsontable';
class RatingEditor extends BaseEditor {
override getValue(): string {
return this.TEXTAREA?.value ?? '';
}
override setValue(newValue: string): void {
if (this.TEXTAREA) {
this.TEXTAREA.value = newValue;
}
}
}
const settings: GridSettings = {
columns: [{ editor: RatingEditor as unknown as string }],
licenseKey: 'non-commercial-and-evaluation',
};

Type the HOT instance in a React ref

import { useRef } from 'react';
import { HotTable } from '@handsontable/react-wrapper';
import type { HotInstance, GridSettings } from 'handsontable';
export function Grid() {
const hotRef = useRef<HotInstance | null>(null);
const settings: GridSettings = {
data: myData,
licenseKey: 'non-commercial-and-evaluation',
};
return (
<HotTable
ref={hotRef}
settings={settings}
/>
);
}

Type the HOT instance in Angular

Related guides

Related API reference