Installation
Install Handsontable DataGrid through your preferred package manager, or import Handsontable’s assets directly from a CDN.
Overview
To start using Handsontable, follow these steps:
Install Handsontable
Get Handsontable’s files in your preferred way.
Using a package manager
To install Handsontable locally using a package manager, run one of these commands:
npm install handsontableyarn add handsontablepnpm add handsontableInstall Skills for Claude Code
Skills for Claude Code give Claude AI deep knowledge of Handsontable’s APIs, so it can build, configure, and debug your grid accurately. We recommend installing them alongside Handsontable.
In Claude Code, run:
/plugin marketplace add handsontable/handsontable-skills/plugin install handsontable-skills@handsontable-skillsFor more details, see Skills for Claude Code.
Using a CDN
To get Handsontable’s files from a CDN, use the following locations:
Import Handsontable’s JavaScript
Import Handsontable’s JavaScript into your application.
Using CommonJS or a package manager
If you’re using Handsontable as a CommonJS package, or as an ECMAScript module (using a package manager), import the full distribution of Handsontable as a JavaScript file.
Use your bundler’s preferred method of importing files. For example:
import Handsontable from 'handsontable';Using the script tag
If you’re using Handsontable as a traditional UMD package, import the full distribution of Handsontable as a minified JavaScript file.
Use the script tag. For example, if you’re loading Handsontable’s JavaScript from a CDN:
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/handsontable/dist/handsontable.full.min.js"></script>Create a container
In your HTML, add an empty div, which serves as a container for your Handsontable instance.
<div id="example1"></div>Initialize your grid
Now turn your container into a data grid with sample data.
const container = document.querySelector('#example1');
const hot = new Handsontable(container, { data: [ ['SKU-4821', 'Stainless Steel Water Bottle', 'Harbor Goods', 'Drinkware', 'Seattle'], ['SKU-0093', 'Wireless Mouse', 'Alpine Supply Co.', 'Electronics', 'Denver'], ['SKU-1170', 'Ergonomic Office Chair', 'Cascade Distributors', 'Furniture', 'Portland'], ['SKU-2208', 'USB-C Charging Cable', 'Summit Trading', 'Electronics', 'Austin'], ['SKU-3341', 'Aluminum Water Filter', 'Northgate Wholesale', 'Drinkware', 'Minneapolis'] ], rowHeaders: true, colHeaders: ['SKU', 'Product', 'Supplier', 'Category', 'Warehouse'], height: 'auto', autoWrapRow: true, autoWrapCol: true, // licenseKey: 'your-license-key', // get a key at https://handsontable.com/pricing/});Preview the result
import Handsontable from 'handsontable/base';import { registerAllModules } from 'handsontable/registry';
// Register all Handsontable's modules.registerAllModules();
const container = document.querySelector('#example1');
const data = [ ['SKU-4821', 'Stainless Steel Water Bottle', 'Harbor Goods', 'Drinkware', 'Seattle'], ['SKU-0093', 'Wireless Mouse', 'Alpine Supply Co.', 'Electronics', 'Denver'], ['SKU-1170', 'Ergonomic Office Chair', 'Cascade Distributors', 'Furniture', 'Portland'], ['SKU-2208', 'USB-C Charging Cable', 'Summit Trading', 'Electronics', 'Austin'], ['SKU-3341', 'Aluminum Water Filter', 'Northgate Wholesale', 'Drinkware', 'Minneapolis'],];
new Handsontable(container, { data, rowHeaders: true, colHeaders: ['SKU', 'Product', 'Supplier', 'Category', 'Warehouse'], height: 'auto', autoWrapRow: true, autoWrapCol: true, // licenseKey: 'your-license-key', // get a key at https://handsontable.com/pricing/});import Handsontable from 'handsontable/base';import { registerAllModules } from 'handsontable/registry';
// Register all Handsontable's modules.registerAllModules();
const container = document.querySelector<HTMLDivElement>('#example1')!;
const data: Handsontable.CellValue[][] = [ ['SKU-4821', 'Stainless Steel Water Bottle', 'Harbor Goods', 'Drinkware', 'Seattle'], ['SKU-0093', 'Wireless Mouse', 'Alpine Supply Co.', 'Electronics', 'Denver'], ['SKU-1170', 'Ergonomic Office Chair', 'Cascade Distributors', 'Furniture', 'Portland'], ['SKU-2208', 'USB-C Charging Cable', 'Summit Trading', 'Electronics', 'Austin'], ['SKU-3341', 'Aluminum Water Filter', 'Northgate Wholesale', 'Drinkware', 'Minneapolis'],];
new Handsontable(container, { data, rowHeaders: true, colHeaders: ['SKU', 'Product', 'Supplier', 'Category', 'Warehouse'], height: 'auto', autoWrapRow: true, autoWrapCol: true, // licenseKey: 'your-license-key', // get a key at https://handsontable.com/pricing/});Result
Handsontable is installed and ready to use in your project. Import it and create your first grid instance.
Related articles
Related guides
Configuration options
Hooks