Skip to content

Install Handsontable through your preferred package manager, and control your grid through the HotTableComponent props.

Install Handsontable

To install Handsontable locally using a package manager, run one of these commands:

npm
npm install handsontable @handsontable/angular-wrapper
Yarn
yarn add handsontable @handsontable/angular-wrapper
pnpm
pnpm add handsontable @handsontable/angular-wrapper

Register Handsontable’s modules

Import and register all of Handsontable’s modules with a single function call (for example, in app.component.ts):

import Handsontable from "handsontable/base";
import { registerAllModules } from "handsontable/registry";
registerAllModules();

Or, to reduce the size of your JavaScript bundle, import only the modules that you need.

Configure global settings

You can set global configuration values for the table during the application setup (app.config.ts). Using the HOT_GLOBAL_CONFIG token, you can define an object that will be read within the wrapper. At any time, you can modify these values using the HotGlobalConfigService or override them at the individual table level. All properties of HotGlobalConfig object are optional.

import { ApplicationConfig, provideZoneChangeDetection } from "@angular/core";
import { provideRouter } from "@angular/router";
import { routes } from "./app.routes";
import {
HOT_GLOBAL_CONFIG,
HotGlobalConfig,
NON_COMMERCIAL_LICENSE,
} from "@handsontable/angular-wrapper";
import { registerLanguageDictionary, enUS } from "handsontable/i18n";
registerLanguageDictionary(enUS);
const globalHotConfig: HotGlobalConfig = {
license: NON_COMMERCIAL_LICENSE,
layoutDirection: "ltr",
language: enUS.languageCode,
};
export const appConfig: ApplicationConfig = {
providers: [
{ provide: HOT_GLOBAL_CONFIG, useValue: globalHotConfig },
],
};

Use the HotTable Component

The main Handsontable component is called HotTableComponent. To use it, you need to import the HotTableModule in your component or module.

import {
HotTableModule,
} from '@handsontable/angular-wrapper';
@Component({
standalone: true,
imports: [HotTableModule],
})

To set Handsontable’s configuration options, use GridSettings object. For example:

import { Component, ViewChild } from "@angular/core";
import {
GridSettings,
HotTableComponent,
HotTableModule,
} from "@handsontable/angular-wrapper";
@Component({
standalone: true,
imports: [HotTableModule],
template: ` <div>
<hot-table [data]="data" [settings]="gridSettings" />
</div>`,
})
export class HotTableWrapperComponent {
@ViewChild(HotTableComponent, { static: false })
readonly hotTable!: HotTableComponent;
readonly data = [
["", "Tesla", "Volvo", "Toyota", "Ford"],
["2019", 10, 11, 12, 13],
["2020", 20, 11, 14, 13],
["2021", 30, 15, 12, 13],
];
readonly gridSettings = <GridSettings>{
rowHeaders: true,
colHeaders: true,
height: "auto",
autoWrapRow: true,
autoWrapCol: true,
};
}

Preview the result

TypeScript
/* file: app.component.ts */
import { Component } from '@angular/core';
import { GridSettings } from '@handsontable/angular-wrapper';
@Component({
selector: 'example-installation',
standalone: false,
template: ` <div>
<hot-table [data]="data" [settings]="gridSettings"></hot-table>
</div>`,
})
export class ExampleInstallationComponent {
readonly data = [
['', 'Tesla', 'Volvo', 'Toyota', 'Ford'],
['2019', 10, 11, 12, 13],
['2020', 20, 11, 14, 13],
['2021', 30, 15, 12, 13],
];
readonly gridSettings: GridSettings = {
rowHeaders: true,
colHeaders: true,
height: 'auto',
autoWrapRow: true,
autoWrapCol: true
};
}
/* end-file */
/* file: app.module.ts */
import { NgModule, ApplicationConfig } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { registerAllModules } from 'handsontable/registry';
import { HOT_GLOBAL_CONFIG, HotGlobalConfig, HotTableModule } from '@handsontable/angular-wrapper';
import { CommonModule } from '@angular/common';
import { NON_COMMERCIAL_LICENSE } from '@handsontable/angular-wrapper';
/* start:skip-in-compilation */
import { ExampleInstallationComponent } from './app.component';
/* end:skip-in-compilation */
// register Handsontable's modules
registerAllModules();
export const appConfig: ApplicationConfig = {
providers: [
{
provide: HOT_GLOBAL_CONFIG,
useValue: {
license: NON_COMMERCIAL_LICENSE,
} as HotGlobalConfig
}
],
};
@NgModule({
imports: [ BrowserModule, HotTableModule, CommonModule ],
declarations: [ ExampleInstallationComponent ],
providers: [...appConfig.providers],
bootstrap: [ ExampleInstallationComponent ]
})
export class AppModule { }
/* end-file */
HTML
<div>
<example-installation></example-installation>
</div>

Supported versions of Angular

@handsontable/angular-wrapper requires at least Angular@16. If you use a lower version of Angular, you can use the @handsontable/angular package instead.

For more information on @handsontable/angular, see the 15.3 documentation.

Angular versionHandsontable wrapper
Older than 16@handsontable/angular (deprecated)
16 and newer@handsontable/angular-wrapper

Troubleshooting

If you’re using Angular 21 or newer, please note that older versions of @handsontable/angular-wrapper are incompatible due to recent breaking changes in Angular. To ensure smooth integration, upgrade to @handsontable/angular-wrapper@16.2 or later.

Server Side Rendering (SSR)

Currently, HotTable cannot be rendered on the server-side. If your application uses SSR, render it only in the browser using an *ngIf* statement.

import { CommonModule, isPlatformBrowser } from "@angular/common";
import { Component, inject, PLATFORM_ID } from "@angular/core";
import { GridSettings, HotTableModule } from "@handsontable/angular-wrapper";
import { registerAllModules } from "handsontable/registry";
registerAllModules();
@Component({
selector: "app-root",
imports: [HotTableModule, CommonModule],
templateUrl: "./app.html",
styleUrl: "./app.scss",
})
export class App {
private platformId = inject(PLATFORM_ID);
readonly isBrowser = isPlatformBrowser(this.platformId);
readonly data = [
["", "Tesla", "Volvo", "Toyota", "Ford"],
["2019", 10, 11, 12, 13],
["2020", 20, 11, 14, 13],
["2021", 30, 15, 12, 13],
];
readonly gridSettings: GridSettings = {
rowHeaders: true,
colHeaders: true,
height: "auto",
autoWrapRow: true,
autoWrapCol: true,
manualRowResize: true,
manualColumnResize: true,
};
}
<div>
<ng-container *ngIf="isBrowser">
<hot-table [data]="data" [settings]="gridSettings" />
</ng-container>
</div>

Related guides

Configuration options

Hooks