Skip to content

Install Handsontable through your preferred package manager, and control your grid through the HotTable component’s props.

Install Handsontable

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

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

Register Handsontable’s modules

Import and register all of Handsontable’s modules with a single function call:

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.

Use the HotTable component

The main Handsontable component is called HotTable.

import { HotTable } from '@handsontable/react-wrapper';

To set Handsontable’s configuration options, use HotTable’s props. For example:

<HotTable
data={[
['', 'Tesla', 'Volvo', 'Toyota', 'Ford'],
['2019', 10, 11, 12, 13],
['2020', 20, 11, 14, 13],
['2021', 30, 15, 12, 13]
]}
rowHeaders={true}
colHeaders={true}
height="auto"
autoWrapRow={true}
autoWrapCol={true}
licenseKey="non-commercial-and-evaluation" // for non-commercial use only
/>

Preview the result

JavaScript
import { HotTable } from '@handsontable/react-wrapper';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const ExampleComponent = () => {
return (
<HotTable
data={[
['', 'Tesla', 'Volvo', 'Toyota', 'Ford'],
['2019', 10, 11, 12, 13],
['2020', 20, 11, 14, 13],
['2021', 30, 15, 12, 13],
]}
rowHeaders={true}
colHeaders={true}
height="auto"
autoWrapRow={true}
autoWrapCol={true}
licenseKey="non-commercial-and-evaluation" // for non-commercial use only
/>
);
};
export default ExampleComponent;
TypeScript
import { FC } from 'react';
import { HotTable, HotTableProps } from '@handsontable/react-wrapper';
import Handsontable from 'handsontable/base';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const ExampleComponent: FC = () => {
return (
<HotTable
data={[
['', 'Tesla', 'Volvo', 'Toyota', 'Ford'],
['2019', 10, 11, 12, 13],
['2020', 20, 11, 14, 13],
['2021', 30, 15, 12, 13],
]}
rowHeaders={true}
colHeaders={true}
height="auto"
autoWrapRow={true}
autoWrapCol={true}
licenseKey="non-commercial-and-evaluation" // for non-commercial use only
/>
);
};
export default ExampleComponent;

Related guides

Configuration options

Hooks