Skip to content

Display modal dialogs, alerts, loading indicators, and notifications to enhance user interaction and provide feedback in your data grid application.

Overview

The Dialog plugin provides a modal dialog system for Handsontable that allows you to display custom content in modal dialogs that overlay the table. This is useful for showing notifications, error messages, loading indicators, or any other interactive content that requires user attention.

The dialog system is designed to be flexible and customizable, supporting various content types including plain text, HTML, and DOM elements. It also provides options for styling, animations, and user interaction controls.

Basic configuration

To enable the Dialog plugin, set the dialog option to true or provide a configuration object.

JavaScript
import React, { useRef, useEffect } from 'react';
import { HotTable, HotColumn } from '@handsontable/react-wrapper';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const data = [
{ model: 'Trail Helmet', price: 1298.14, sellDate: '2025-08-31', sellTime: '14:12', inStock: true },
{ model: 'Windbreaker Jacket', price: 178.9, sellDate: '2025-05-10', sellTime: '22:26', inStock: false },
{ model: 'Cycling Cap', price: 288.1, sellDate: '2025-09-15', sellTime: '09:37', inStock: true },
{ model: 'HL Mountain Frame', price: 94.49, sellDate: '2025-01-17', sellTime: '14:19', inStock: false },
{ model: 'Racing Socks', price: 430.38, sellDate: '2025-05-10', sellTime: '13:42', inStock: true },
{ model: 'Racing Socks', price: 138.85, sellDate: '2025-09-20', sellTime: '14:48', inStock: true },
{ model: 'HL Mountain Frame', price: 1909.63, sellDate: '2025-09-05', sellTime: '09:35', inStock: false },
{ model: 'Carbon Handlebar', price: 1080.7, sellDate: '2025-10-24', sellTime: '22:58', inStock: false },
{ model: 'Aero Bottle', price: 1571.13, sellDate: '2025-05-24', sellTime: '00:24', inStock: true },
{ model: 'Windbreaker Jacket', price: 919.09, sellDate: '2025-07-16', sellTime: '19:11', inStock: true },
{ model: 'HL Road Tire', price: 886.22, sellDate: '2025-09-09', sellTime: '00:42', inStock: false },
{ model: 'Speed Gloves', price: 635.13, sellDate: '2025-11-17', sellTime: '12:45', inStock: true },
{ model: 'Trail Helmet', price: 1440.64, sellDate: '2025-01-03', sellTime: '20:16', inStock: false },
{ model: 'Aero Bottle', price: 944.63, sellDate: '2025-11-15', sellTime: '16:14', inStock: false },
{ model: 'Windbreaker Jacket', price: 1161.43, sellDate: '2025-06-24', sellTime: '13:19', inStock: false },
{ model: 'LED Bike Light', price: 1012.5, sellDate: '2025-05-01', sellTime: '17:30', inStock: false },
{ model: 'Windbreaker Jacket', price: 635.37, sellDate: '2025-05-14', sellTime: '09:05', inStock: true },
{ model: 'Road Tire Tube', price: 1421.27, sellDate: '2025-01-31', sellTime: '13:33', inStock: true },
{ model: 'Action Camera', price: 1019.05, sellDate: '2025-12-07', sellTime: '01:26', inStock: false },
{ model: 'Carbon Handlebar', price: 603.96, sellDate: '2025-09-13', sellTime: '04:10', inStock: false },
];
const ExampleComponent = () => {
const hotTableRef = useRef(null);
useEffect(() => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
hotInstance.getPlugin('dialog').show({
content: 'This is a basic dialog with default configuration.',
closable: true,
});
}, []);
return (
<HotTable
ref={hotTableRef}
data={data}
width="100%"
height={300}
stretchH="all"
contextMenu={true}
rowHeaders={true}
colHeaders={true}
autoWrapRow={true}
autoWrapCol={true}
autoRowSize={true}
dialog={true}
licenseKey="non-commercial-and-evaluation"
>
<HotColumn title="Model" type="text" data="model" width={150} headerClassName="htLeft" />
<HotColumn
title="Price"
type="numeric"
data="price"
width={80}
locale="en-US"
numericFormat={{ style: 'currency', currency: 'USD', minimumFractionDigits: 2 }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Date"
type="intl-date"
data="sellDate"
width={131}
locale="en-US"
dateFormat={{ month: 'short', day: 'numeric', year: 'numeric' }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Time"
type="intl-time"
data="sellTime"
width={90}
timeFormat={{ hour: '2-digit', minute: '2-digit', hour12: true }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn title="In stock" type="checkbox" data="inStock" className="htCenter" headerClassName="htCenter" />
</HotTable>
);
};
export default ExampleComponent;
TypeScript
import React, { useRef, useEffect } from 'react';
import { HotTable, HotColumn } from '@handsontable/react-wrapper';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const data = [
{ model: 'Trail Helmet', price: 1298.14, sellDate: '2025-08-31', sellTime: '14:12', inStock: true },
{ model: 'Windbreaker Jacket', price: 178.9, sellDate: '2025-05-10', sellTime: '22:26', inStock: false },
{ model: 'Cycling Cap', price: 288.1, sellDate: '2025-09-15', sellTime: '09:37', inStock: true },
{ model: 'HL Mountain Frame', price: 94.49, sellDate: '2025-01-17', sellTime: '14:19', inStock: false },
{ model: 'Racing Socks', price: 430.38, sellDate: '2025-05-10', sellTime: '13:42', inStock: true },
{ model: 'Racing Socks', price: 138.85, sellDate: '2025-09-20', sellTime: '14:48', inStock: true },
{ model: 'HL Mountain Frame', price: 1909.63, sellDate: '2025-09-05', sellTime: '09:35', inStock: false },
{ model: 'Carbon Handlebar', price: 1080.7, sellDate: '2025-10-24', sellTime: '22:58', inStock: false },
{ model: 'Aero Bottle', price: 1571.13, sellDate: '2025-05-24', sellTime: '00:24', inStock: true },
{ model: 'Windbreaker Jacket', price: 919.09, sellDate: '2025-07-16', sellTime: '19:11', inStock: true },
{ model: 'HL Road Tire', price: 886.22, sellDate: '2025-09-09', sellTime: '00:42', inStock: false },
{ model: 'Speed Gloves', price: 635.13, sellDate: '2025-11-17', sellTime: '12:45', inStock: true },
{ model: 'Trail Helmet', price: 1440.64, sellDate: '2025-01-03', sellTime: '20:16', inStock: false },
{ model: 'Aero Bottle', price: 944.63, sellDate: '2025-11-15', sellTime: '16:14', inStock: false },
{ model: 'Windbreaker Jacket', price: 1161.43, sellDate: '2025-06-24', sellTime: '13:19', inStock: false },
{ model: 'LED Bike Light', price: 1012.5, sellDate: '2025-05-01', sellTime: '17:30', inStock: false },
{ model: 'Windbreaker Jacket', price: 635.37, sellDate: '2025-05-14', sellTime: '09:05', inStock: true },
{ model: 'Road Tire Tube', price: 1421.27, sellDate: '2025-01-31', sellTime: '13:33', inStock: true },
{ model: 'Action Camera', price: 1019.05, sellDate: '2025-12-07', sellTime: '01:26', inStock: false },
{ model: 'Carbon Handlebar', price: 603.96, sellDate: '2025-09-13', sellTime: '04:10', inStock: false },
];
const ExampleComponent = () => {
const hotTableRef = useRef(null);
useEffect(() => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
hotInstance.getPlugin('dialog').show({
content: 'This is a basic dialog with default configuration.',
closable: true,
});
}, []);
return (
<HotTable
ref={hotTableRef}
data={data}
width="100%"
height={300}
stretchH="all"
contextMenu={true}
rowHeaders={true}
colHeaders={true}
autoWrapRow={true}
autoWrapCol={true}
autoRowSize={true}
dialog={true}
licenseKey="non-commercial-and-evaluation"
>
<HotColumn title="Model" type="text" data="model" width={150} headerClassName="htLeft" />
<HotColumn
title="Price"
type="numeric"
data="price"
width={80}
locale="en-US" numericFormat={{ style: 'currency', currency: 'USD', minimumFractionDigits: 2 }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Date"
type="intl-date"
data="sellDate"
width={131}
locale="en-US" dateFormat={{ month: 'short', day: 'numeric', year: 'numeric' }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Time"
type="intl-time"
data="sellTime"
width={90}
timeFormat={{ hour: '2-digit', minute: '2-digit', hour12: true }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn title="In stock" type="checkbox" data="inStock" className="htCenter" headerClassName="htCenter" />
</HotTable>
);
};
export default ExampleComponent;

Content types

The dialog supports multiple content types including plain text, HTML strings, and DOM elements.

Plain text content

JavaScript
import React, { useRef, useEffect } from 'react';
import { HotTable, HotColumn } from '@handsontable/react-wrapper';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const data = [
{ model: 'Trail Helmet', price: 1298.14, sellDate: '2025-08-31', sellTime: '14:12', inStock: true },
{ model: 'Windbreaker Jacket', price: 178.9, sellDate: '2025-05-10', sellTime: '22:26', inStock: false },
{ model: 'Cycling Cap', price: 288.1, sellDate: '2025-09-15', sellTime: '09:37', inStock: true },
{ model: 'HL Mountain Frame', price: 94.49, sellDate: '2025-01-17', sellTime: '14:19', inStock: false },
{ model: 'Racing Socks', price: 430.38, sellDate: '2025-05-10', sellTime: '13:42', inStock: true },
{ model: 'Racing Socks', price: 138.85, sellDate: '2025-09-20', sellTime: '14:48', inStock: true },
{ model: 'HL Mountain Frame', price: 1909.63, sellDate: '2025-09-05', sellTime: '09:35', inStock: false },
{ model: 'Carbon Handlebar', price: 1080.7, sellDate: '2025-10-24', sellTime: '22:58', inStock: false },
{ model: 'Aero Bottle', price: 1571.13, sellDate: '2025-05-24', sellTime: '00:24', inStock: true },
{ model: 'Windbreaker Jacket', price: 919.09, sellDate: '2025-07-16', sellTime: '19:11', inStock: true },
{ model: 'HL Road Tire', price: 886.22, sellDate: '2025-09-09', sellTime: '00:42', inStock: false },
{ model: 'Speed Gloves', price: 635.13, sellDate: '2025-11-17', sellTime: '12:45', inStock: true },
{ model: 'Trail Helmet', price: 1440.64, sellDate: '2025-01-03', sellTime: '20:16', inStock: false },
{ model: 'Aero Bottle', price: 944.63, sellDate: '2025-11-15', sellTime: '16:14', inStock: false },
{ model: 'Windbreaker Jacket', price: 1161.43, sellDate: '2025-06-24', sellTime: '13:19', inStock: false },
{ model: 'LED Bike Light', price: 1012.5, sellDate: '2025-05-01', sellTime: '17:30', inStock: false },
{ model: 'Windbreaker Jacket', price: 635.37, sellDate: '2025-05-14', sellTime: '09:05', inStock: true },
{ model: 'Road Tire Tube', price: 1421.27, sellDate: '2025-01-31', sellTime: '13:33', inStock: true },
{ model: 'Action Camera', price: 1019.05, sellDate: '2025-12-07', sellTime: '01:26', inStock: false },
{ model: 'Carbon Handlebar', price: 603.96, sellDate: '2025-09-13', sellTime: '04:10', inStock: false },
];
const ExampleComponent = () => {
const hotTableRef = useRef(null);
useEffect(() => {
const hotInstance = hotTableRef.current?.hotInstance;
hotInstance.getPlugin('dialog').show();
}, []);
return (
<HotTable
ref={hotTableRef}
data={data}
width="100%"
height={300}
stretchH="all"
contextMenu={true}
rowHeaders={true}
colHeaders={true}
autoWrapRow={true}
autoWrapCol={true}
autoRowSize={true}
dialog={{
content: 'This is a simple text message displayed in the dialog.',
closable: true,
}}
licenseKey="non-commercial-and-evaluation"
>
<HotColumn title="Model" type="text" data="model" width={150} headerClassName="htLeft" />
<HotColumn
title="Price"
type="numeric"
data="price"
width={80}
locale="en-US"
numericFormat={{ style: 'currency', currency: 'USD', minimumFractionDigits: 2 }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Date"
type="intl-date"
data="sellDate"
width={131}
locale="en-US"
dateFormat={{ month: 'short', day: 'numeric', year: 'numeric' }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Time"
type="intl-time"
data="sellTime"
width={90}
timeFormat={{ hour: '2-digit', minute: '2-digit', hour12: true }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn title="In stock" type="checkbox" data="inStock" className="htCenter" headerClassName="htCenter" />
</HotTable>
);
};
export default ExampleComponent;
TypeScript
import React, { useRef, useEffect } from 'react';
import { HotTable, HotColumn } from '@handsontable/react-wrapper';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const data = [
{ model: 'Trail Helmet', price: 1298.14, sellDate: '2025-08-31', sellTime: '14:12', inStock: true },
{ model: 'Windbreaker Jacket', price: 178.9, sellDate: '2025-05-10', sellTime: '22:26', inStock: false },
{ model: 'Cycling Cap', price: 288.1, sellDate: '2025-09-15', sellTime: '09:37', inStock: true },
{ model: 'HL Mountain Frame', price: 94.49, sellDate: '2025-01-17', sellTime: '14:19', inStock: false },
{ model: 'Racing Socks', price: 430.38, sellDate: '2025-05-10', sellTime: '13:42', inStock: true },
{ model: 'Racing Socks', price: 138.85, sellDate: '2025-09-20', sellTime: '14:48', inStock: true },
{ model: 'HL Mountain Frame', price: 1909.63, sellDate: '2025-09-05', sellTime: '09:35', inStock: false },
{ model: 'Carbon Handlebar', price: 1080.7, sellDate: '2025-10-24', sellTime: '22:58', inStock: false },
{ model: 'Aero Bottle', price: 1571.13, sellDate: '2025-05-24', sellTime: '00:24', inStock: true },
{ model: 'Windbreaker Jacket', price: 919.09, sellDate: '2025-07-16', sellTime: '19:11', inStock: true },
{ model: 'HL Road Tire', price: 886.22, sellDate: '2025-09-09', sellTime: '00:42', inStock: false },
{ model: 'Speed Gloves', price: 635.13, sellDate: '2025-11-17', sellTime: '12:45', inStock: true },
{ model: 'Trail Helmet', price: 1440.64, sellDate: '2025-01-03', sellTime: '20:16', inStock: false },
{ model: 'Aero Bottle', price: 944.63, sellDate: '2025-11-15', sellTime: '16:14', inStock: false },
{ model: 'Windbreaker Jacket', price: 1161.43, sellDate: '2025-06-24', sellTime: '13:19', inStock: false },
{ model: 'LED Bike Light', price: 1012.5, sellDate: '2025-05-01', sellTime: '17:30', inStock: false },
{ model: 'Windbreaker Jacket', price: 635.37, sellDate: '2025-05-14', sellTime: '09:05', inStock: true },
{ model: 'Road Tire Tube', price: 1421.27, sellDate: '2025-01-31', sellTime: '13:33', inStock: true },
{ model: 'Action Camera', price: 1019.05, sellDate: '2025-12-07', sellTime: '01:26', inStock: false },
{ model: 'Carbon Handlebar', price: 603.96, sellDate: '2025-09-13', sellTime: '04:10', inStock: false },
];
const ExampleComponent = () => {
const hotTableRef = useRef(null);
useEffect(() => {
const hotInstance = hotTableRef.current?.hotInstance;
hotInstance.getPlugin('dialog').show();
}, []);
return (
<HotTable
ref={hotTableRef}
data={data}
width="100%"
height={300}
stretchH="all"
contextMenu={true}
rowHeaders={true}
colHeaders={true}
autoWrapRow={true}
autoWrapCol={true}
autoRowSize={true}
dialog={{
content: 'This is a simple text message displayed in the dialog.',
closable: true,
}}
licenseKey="non-commercial-and-evaluation"
>
<HotColumn title="Model" type="text" data="model" width={150} headerClassName="htLeft" />
<HotColumn
title="Price"
type="numeric"
data="price"
width={80}
locale="en-US" numericFormat={{ style: 'currency', currency: 'USD', minimumFractionDigits: 2 }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Date"
type="intl-date"
data="sellDate"
width={131}
locale="en-US" dateFormat={{ month: 'short', day: 'numeric', year: 'numeric' }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Time"
type="intl-time"
data="sellTime"
width={90}
timeFormat={{ hour: '2-digit', minute: '2-digit', hour12: true }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn title="In stock" type="checkbox" data="inStock" className="htCenter" headerClassName="htCenter" />
</HotTable>
);
};
export default ExampleComponent;

HTML content

JavaScript
import React, { useRef, useEffect } from 'react';
import { HotTable, HotColumn } from '@handsontable/react-wrapper';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const data = [
{ model: 'Trail Helmet', price: 1298.14, sellDate: '2025-08-31', sellTime: '14:12', inStock: true },
{ model: 'Windbreaker Jacket', price: 178.9, sellDate: '2025-05-10', sellTime: '22:26', inStock: false },
{ model: 'Cycling Cap', price: 288.1, sellDate: '2025-09-15', sellTime: '09:37', inStock: true },
{ model: 'HL Mountain Frame', price: 94.49, sellDate: '2025-01-17', sellTime: '14:19', inStock: false },
{ model: 'Racing Socks', price: 430.38, sellDate: '2025-05-10', sellTime: '13:42', inStock: true },
{ model: 'Racing Socks', price: 138.85, sellDate: '2025-09-20', sellTime: '14:48', inStock: true },
{ model: 'HL Mountain Frame', price: 1909.63, sellDate: '2025-09-05', sellTime: '09:35', inStock: false },
{ model: 'Carbon Handlebar', price: 1080.7, sellDate: '2025-10-24', sellTime: '22:58', inStock: false },
{ model: 'Aero Bottle', price: 1571.13, sellDate: '2025-05-24', sellTime: '00:24', inStock: true },
{ model: 'Windbreaker Jacket', price: 919.09, sellDate: '2025-07-16', sellTime: '19:11', inStock: true },
{ model: 'HL Road Tire', price: 886.22, sellDate: '2025-09-09', sellTime: '00:42', inStock: false },
{ model: 'Speed Gloves', price: 635.13, sellDate: '2025-11-17', sellTime: '12:45', inStock: true },
{ model: 'Trail Helmet', price: 1440.64, sellDate: '2025-01-03', sellTime: '20:16', inStock: false },
{ model: 'Aero Bottle', price: 944.63, sellDate: '2025-11-15', sellTime: '16:14', inStock: false },
{ model: 'Windbreaker Jacket', price: 1161.43, sellDate: '2025-06-24', sellTime: '13:19', inStock: false },
{ model: 'LED Bike Light', price: 1012.5, sellDate: '2025-05-01', sellTime: '17:30', inStock: false },
{ model: 'Windbreaker Jacket', price: 635.37, sellDate: '2025-05-14', sellTime: '09:05', inStock: true },
{ model: 'Road Tire Tube', price: 1421.27, sellDate: '2025-01-31', sellTime: '13:33', inStock: true },
{ model: 'Action Camera', price: 1019.05, sellDate: '2025-12-07', sellTime: '01:26', inStock: false },
{ model: 'Carbon Handlebar', price: 603.96, sellDate: '2025-09-13', sellTime: '04:10', inStock: false },
];
const ExampleComponent = () => {
const hotTableRef = useRef(null);
useEffect(() => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
hotInstance.getPlugin('dialog').show();
document.getElementById('example3-button')?.addEventListener('click', () => {
hotInstance.getPlugin('dialog').hide();
});
}, []);
return (
<HotTable
ref={hotTableRef}
data={data}
width="100%"
height={300}
stretchH="all"
contextMenu={true}
rowHeaders={true}
colHeaders={true}
autoWrapRow={true}
autoWrapCol={true}
autoRowSize={true}
dialog={{
content:
'<p>This dialog contains <strong>HTML</strong> content with formatting.</p><button id="example3-button">Hide dialog</button>',
closable: true,
}}
licenseKey="non-commercial-and-evaluation"
>
<HotColumn title="Model" type="text" data="model" width={150} headerClassName="htLeft" />
<HotColumn
title="Price"
type="numeric"
data="price"
width={80}
locale="en-US"
numericFormat={{ style: 'currency', currency: 'USD', minimumFractionDigits: 2 }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Date"
type="intl-date"
data="sellDate"
width={131}
locale="en-US"
dateFormat={{ month: 'short', day: 'numeric', year: 'numeric' }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Time"
type="intl-time"
data="sellTime"
width={90}
timeFormat={{ hour: '2-digit', minute: '2-digit', hour12: true }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn title="In stock" type="checkbox" data="inStock" className="htCenter" headerClassName="htCenter" />
</HotTable>
);
};
export default ExampleComponent;
TypeScript
import React, { useRef, useEffect } from 'react';
import { HotTable, HotColumn } from '@handsontable/react-wrapper';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const data = [
{ model: 'Trail Helmet', price: 1298.14, sellDate: '2025-08-31', sellTime: '14:12', inStock: true },
{ model: 'Windbreaker Jacket', price: 178.9, sellDate: '2025-05-10', sellTime: '22:26', inStock: false },
{ model: 'Cycling Cap', price: 288.1, sellDate: '2025-09-15', sellTime: '09:37', inStock: true },
{ model: 'HL Mountain Frame', price: 94.49, sellDate: '2025-01-17', sellTime: '14:19', inStock: false },
{ model: 'Racing Socks', price: 430.38, sellDate: '2025-05-10', sellTime: '13:42', inStock: true },
{ model: 'Racing Socks', price: 138.85, sellDate: '2025-09-20', sellTime: '14:48', inStock: true },
{ model: 'HL Mountain Frame', price: 1909.63, sellDate: '2025-09-05', sellTime: '09:35', inStock: false },
{ model: 'Carbon Handlebar', price: 1080.7, sellDate: '2025-10-24', sellTime: '22:58', inStock: false },
{ model: 'Aero Bottle', price: 1571.13, sellDate: '2025-05-24', sellTime: '00:24', inStock: true },
{ model: 'Windbreaker Jacket', price: 919.09, sellDate: '2025-07-16', sellTime: '19:11', inStock: true },
{ model: 'HL Road Tire', price: 886.22, sellDate: '2025-09-09', sellTime: '00:42', inStock: false },
{ model: 'Speed Gloves', price: 635.13, sellDate: '2025-11-17', sellTime: '12:45', inStock: true },
{ model: 'Trail Helmet', price: 1440.64, sellDate: '2025-01-03', sellTime: '20:16', inStock: false },
{ model: 'Aero Bottle', price: 944.63, sellDate: '2025-11-15', sellTime: '16:14', inStock: false },
{ model: 'Windbreaker Jacket', price: 1161.43, sellDate: '2025-06-24', sellTime: '13:19', inStock: false },
{ model: 'LED Bike Light', price: 1012.5, sellDate: '2025-05-01', sellTime: '17:30', inStock: false },
{ model: 'Windbreaker Jacket', price: 635.37, sellDate: '2025-05-14', sellTime: '09:05', inStock: true },
{ model: 'Road Tire Tube', price: 1421.27, sellDate: '2025-01-31', sellTime: '13:33', inStock: true },
{ model: 'Action Camera', price: 1019.05, sellDate: '2025-12-07', sellTime: '01:26', inStock: false },
{ model: 'Carbon Handlebar', price: 603.96, sellDate: '2025-09-13', sellTime: '04:10', inStock: false },
];
const ExampleComponent = () => {
const hotTableRef = useRef(null);
useEffect(() => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
hotInstance.getPlugin('dialog').show();
document.getElementById('example3-button')?.addEventListener('click', () => {
hotInstance.getPlugin('dialog').hide();
});
}, []);
return (
<HotTable
ref={hotTableRef}
data={data}
width="100%"
height={300}
stretchH="all"
contextMenu={true}
rowHeaders={true}
colHeaders={true}
autoWrapRow={true}
autoWrapCol={true}
autoRowSize={true}
dialog={{
content:
'<p>This dialog contains <strong>HTML</strong> content with formatting.</p><button id="example3-button">Hide dialog</button>',
closable: true,
}}
licenseKey="non-commercial-and-evaluation"
>
<HotColumn title="Model" type="text" data="model" width={150} headerClassName="htLeft" />
<HotColumn
title="Price"
type="numeric"
data="price"
width={80}
locale="en-US" numericFormat={{ style: 'currency', currency: 'USD', minimumFractionDigits: 2 }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Date"
type="intl-date"
data="sellDate"
width={131}
locale="en-US" dateFormat={{ month: 'short', day: 'numeric', year: 'numeric' }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Time"
type="intl-time"
data="sellTime"
width={90}
timeFormat={{ hour: '2-digit', minute: '2-digit', hour12: true }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn title="In stock" type="checkbox" data="inStock" className="htCenter" headerClassName="htCenter" />
</HotTable>
);
};
export default ExampleComponent;

Template types

As the content option allows you to use plain text, HTML strings, and DOM elements, the template option allows you to use predefined dialog templates instead of custom content which can be useful for displaying alerts, confirmations, and other common ready-to-use dialogs.

The plugin offers two new methods to display predefined dialog templates: showAlert and showConfirm. For users looking for more customizability, the show method allows using templates with other options that the dialog offers, such as background variants, content background, and more.

JavaScript
import React, { useRef } from 'react';
import { HotTable, HotColumn } from '@handsontable/react-wrapper';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const data = [
{ model: 'Trail Helmet', price: 1298.14, sellDate: '2025-08-31', sellTime: '14:12', inStock: true },
{ model: 'Windbreaker Jacket', price: 178.9, sellDate: '2025-05-10', sellTime: '22:26', inStock: false },
{ model: 'Cycling Cap', price: 288.1, sellDate: '2025-09-15', sellTime: '09:37', inStock: true },
{ model: 'HL Mountain Frame', price: 94.49, sellDate: '2025-01-17', sellTime: '14:19', inStock: false },
{ model: 'Racing Socks', price: 430.38, sellDate: '2025-05-10', sellTime: '13:42', inStock: true },
{ model: 'Racing Socks', price: 138.85, sellDate: '2025-09-20', sellTime: '14:48', inStock: true },
{ model: 'HL Mountain Frame', price: 1909.63, sellDate: '2025-09-05', sellTime: '09:35', inStock: false },
{ model: 'Carbon Handlebar', price: 1080.7, sellDate: '2025-10-24', sellTime: '22:58', inStock: false },
{ model: 'Aero Bottle', price: 1571.13, sellDate: '2025-05-24', sellTime: '00:24', inStock: true },
{ model: 'Windbreaker Jacket', price: 919.09, sellDate: '2025-07-16', sellTime: '19:11', inStock: true },
{ model: 'HL Road Tire', price: 886.22, sellDate: '2025-09-09', sellTime: '00:42', inStock: false },
{ model: 'Speed Gloves', price: 635.13, sellDate: '2025-11-17', sellTime: '12:45', inStock: true },
{ model: 'Trail Helmet', price: 1440.64, sellDate: '2025-01-03', sellTime: '20:16', inStock: false },
{ model: 'Aero Bottle', price: 944.63, sellDate: '2025-11-15', sellTime: '16:14', inStock: false },
{ model: 'Windbreaker Jacket', price: 1161.43, sellDate: '2025-06-24', sellTime: '13:19', inStock: false },
{ model: 'LED Bike Light', price: 1012.5, sellDate: '2025-05-01', sellTime: '17:30', inStock: false },
{ model: 'Windbreaker Jacket', price: 635.37, sellDate: '2025-05-14', sellTime: '09:05', inStock: true },
{ model: 'Road Tire Tube', price: 1421.27, sellDate: '2025-01-31', sellTime: '13:33', inStock: true },
{ model: 'Action Camera', price: 1019.05, sellDate: '2025-12-07', sellTime: '01:26', inStock: false },
{ model: 'Carbon Handlebar', price: 603.96, sellDate: '2025-09-13', sellTime: '04:10', inStock: false },
];
const ExampleComponent = () => {
const hotTableRef = useRef(null);
const showAlert = () => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
const dialogPlugin = hotInstance.getPlugin('dialog');
dialogPlugin.showAlert(
{
title: 'Alert',
description: 'This is an example of the alert dialog.',
},
() => {
dialogPlugin.hide();
}
);
};
const showConfirm = () => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
const dialogPlugin = hotInstance.getPlugin('dialog');
const undoRedoPlugin = hotInstance.getPlugin('undoRedo');
dialogPlugin.showConfirm(
'Do you want to undo the last action?',
() => {
undoRedoPlugin.undo();
dialogPlugin.hide();
},
() => {
dialogPlugin.hide();
}
);
};
const showCustomConfirm = () => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
const dialogPlugin = hotInstance.getPlugin('dialog');
dialogPlugin.show({
template: {
type: 'confirm',
title: 'Increase the price of the first row by:',
buttons: [
{
text: 'Cancel',
type: 'secondary',
callback: () => {
dialogPlugin.hide();
},
},
{
text: '$100',
type: 'secondary',
callback: () => {
dialogPlugin.hide();
hotInstance.setDataAtCell(0, 1, hotInstance.getDataAtCell(0, 1) + 100);
hotInstance.selectCell(0, 1);
},
},
{
text: '$200',
type: 'secondary',
callback: () => {
dialogPlugin.hide();
hotInstance.setDataAtCell(0, 1, hotInstance.getDataAtCell(0, 1) + 200);
hotInstance.selectCell(0, 1);
},
},
{
text: '$500',
type: 'secondary',
callback: () => {
dialogPlugin.hide();
hotInstance.setDataAtCell(0, 1, hotInstance.getDataAtCell(0, 1) + 500);
hotInstance.selectCell(0, 1);
},
},
],
},
background: 'solid',
contentBackground: false,
closable: true,
});
};
return (
<>
<div style={{ marginBottom: '16px', display: 'flex', gap: '10px' }}>
<button onClick={showAlert}>Show Alert</button>
<button onClick={showConfirm}>Show Confirm</button>
<button onClick={showCustomConfirm}>Show custom Confirm (with solid background)</button>
</div>
<HotTable
ref={hotTableRef}
data={data}
width="100%"
height={300}
stretchH="all"
contextMenu={true}
rowHeaders={true}
colHeaders={true}
autoWrapRow={true}
autoWrapCol={true}
autoRowSize={true}
dialog={true}
licenseKey="non-commercial-and-evaluation"
>
<HotColumn title="Model" type="text" data="model" width={150} headerClassName="htLeft" />
<HotColumn
title="Price"
type="numeric"
data="price"
width={80}
locale="en-US"
numericFormat={{ style: 'currency', currency: 'USD', minimumFractionDigits: 2 }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Date"
type="intl-date"
data="sellDate"
width={131}
locale="en-US"
dateFormat={{ month: 'short', day: 'numeric', year: 'numeric' }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Time"
type="intl-time"
data="sellTime"
width={90}
timeFormat={{ hour: '2-digit', minute: '2-digit', hour12: true }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn title="In stock" type="checkbox" data="inStock" className="htCenter" headerClassName="htCenter" />
</HotTable>
</>
);
};
export default ExampleComponent;
TypeScript
import React, { useRef } from 'react';
import { HotTable, HotColumn } from '@handsontable/react-wrapper';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const data = [
{ model: 'Trail Helmet', price: 1298.14, sellDate: '2025-08-31', sellTime: '14:12', inStock: true },
{ model: 'Windbreaker Jacket', price: 178.9, sellDate: '2025-05-10', sellTime: '22:26', inStock: false },
{ model: 'Cycling Cap', price: 288.1, sellDate: '2025-09-15', sellTime: '09:37', inStock: true },
{ model: 'HL Mountain Frame', price: 94.49, sellDate: '2025-01-17', sellTime: '14:19', inStock: false },
{ model: 'Racing Socks', price: 430.38, sellDate: '2025-05-10', sellTime: '13:42', inStock: true },
{ model: 'Racing Socks', price: 138.85, sellDate: '2025-09-20', sellTime: '14:48', inStock: true },
{ model: 'HL Mountain Frame', price: 1909.63, sellDate: '2025-09-05', sellTime: '09:35', inStock: false },
{ model: 'Carbon Handlebar', price: 1080.7, sellDate: '2025-10-24', sellTime: '22:58', inStock: false },
{ model: 'Aero Bottle', price: 1571.13, sellDate: '2025-05-24', sellTime: '00:24', inStock: true },
{ model: 'Windbreaker Jacket', price: 919.09, sellDate: '2025-07-16', sellTime: '19:11', inStock: true },
{ model: 'HL Road Tire', price: 886.22, sellDate: '2025-09-09', sellTime: '00:42', inStock: false },
{ model: 'Speed Gloves', price: 635.13, sellDate: '2025-11-17', sellTime: '12:45', inStock: true },
{ model: 'Trail Helmet', price: 1440.64, sellDate: '2025-01-03', sellTime: '20:16', inStock: false },
{ model: 'Aero Bottle', price: 944.63, sellDate: '2025-11-15', sellTime: '16:14', inStock: false },
{ model: 'Windbreaker Jacket', price: 1161.43, sellDate: '2025-06-24', sellTime: '13:19', inStock: false },
{ model: 'LED Bike Light', price: 1012.5, sellDate: '2025-05-01', sellTime: '17:30', inStock: false },
{ model: 'Windbreaker Jacket', price: 635.37, sellDate: '2025-05-14', sellTime: '09:05', inStock: true },
{ model: 'Road Tire Tube', price: 1421.27, sellDate: '2025-01-31', sellTime: '13:33', inStock: true },
{ model: 'Action Camera', price: 1019.05, sellDate: '2025-12-07', sellTime: '01:26', inStock: false },
{ model: 'Carbon Handlebar', price: 603.96, sellDate: '2025-09-13', sellTime: '04:10', inStock: false },
];
const ExampleComponent = () => {
const hotTableRef = useRef(null);
const showAlert = () => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
const dialogPlugin = hotInstance.getPlugin('dialog');
dialogPlugin.showAlert(
{
title: 'Alert',
description: 'This is an example of the alert dialog.',
},
() => {
dialogPlugin.hide();
}
);
};
const showConfirm = () => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
const dialogPlugin = hotInstance.getPlugin('dialog');
const undoRedoPlugin = hotInstance.getPlugin('undoRedo');
dialogPlugin.showConfirm(
'Do you want to undo the last action?',
() => {
undoRedoPlugin.undo();
dialogPlugin.hide();
},
() => {
dialogPlugin.hide();
}
);
};
const showCustomConfirm = () => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
const dialogPlugin = hotInstance.getPlugin('dialog');
dialogPlugin.show({
template: {
type: 'confirm',
title: 'Increase the price of the first row by:',
buttons: [
{
text: 'Cancel',
type: 'secondary',
callback: () => {
dialogPlugin.hide();
},
},
{
text: '$100',
type: 'secondary',
callback: () => {
dialogPlugin.hide();
hotInstance.setDataAtCell(0, 1, hotInstance.getDataAtCell(0, 1) + 100);
hotInstance.selectCell(0, 1);
},
},
{
text: '$200',
type: 'secondary',
callback: () => {
dialogPlugin.hide();
hotInstance.setDataAtCell(0, 1, hotInstance.getDataAtCell(0, 1) + 200);
hotInstance.selectCell(0, 1);
},
},
{
text: '$500',
type: 'secondary',
callback: () => {
dialogPlugin.hide();
hotInstance.setDataAtCell(0, 1, hotInstance.getDataAtCell(0, 1) + 500);
hotInstance.selectCell(0, 1);
},
},
],
},
background: 'solid',
contentBackground: false,
closable: true,
});
};
return (
<>
<div style={{ marginBottom: '16px', display: 'flex', gap: '10px' }}>
<button onClick={showAlert}>Show Alert</button>
<button onClick={showConfirm}>Show Confirm</button>
<button onClick={showCustomConfirm}>Show custom Confirm (with solid background)</button>
</div>
<HotTable
ref={hotTableRef}
data={data}
width="100%"
height={300}
stretchH="all"
contextMenu={true}
rowHeaders={true}
colHeaders={true}
autoWrapRow={true}
autoWrapCol={true}
autoRowSize={true}
dialog={true}
licenseKey="non-commercial-and-evaluation"
>
<HotColumn title="Model" type="text" data="model" width={150} headerClassName="htLeft" />
<HotColumn
title="Price"
type="numeric"
data="price"
width={80}
locale="en-US" numericFormat={{ style: 'currency', currency: 'USD', minimumFractionDigits: 2 }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Date"
type="intl-date"
data="sellDate"
width={131}
locale="en-US" dateFormat={{ month: 'short', day: 'numeric', year: 'numeric' }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Time"
type="intl-time"
data="sellTime"
width={90}
timeFormat={{ hour: '2-digit', minute: '2-digit', hour12: true }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn title="In stock" type="checkbox" data="inStock" className="htCenter" headerClassName="htCenter" />
</HotTable>
</>
);
};
export default ExampleComponent;

Background variants

The dialog supports two background variants: solid and semi-transparent.

JavaScript
import React, { useRef, useEffect, useState } from 'react';
import { HotTable, HotColumn } from '@handsontable/react-wrapper';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const data = [
{ model: 'Trail Helmet', price: 1298.14, sellDate: '2025-08-31', sellTime: '14:12', inStock: true },
{ model: 'Windbreaker Jacket', price: 178.9, sellDate: '2025-05-10', sellTime: '22:26', inStock: false },
{ model: 'Cycling Cap', price: 288.1, sellDate: '2025-09-15', sellTime: '09:37', inStock: true },
{ model: 'HL Mountain Frame', price: 94.49, sellDate: '2025-01-17', sellTime: '14:19', inStock: false },
{ model: 'Racing Socks', price: 430.38, sellDate: '2025-05-10', sellTime: '13:42', inStock: true },
{ model: 'Racing Socks', price: 138.85, sellDate: '2025-09-20', sellTime: '14:48', inStock: true },
{ model: 'HL Mountain Frame', price: 1909.63, sellDate: '2025-09-05', sellTime: '09:35', inStock: false },
{ model: 'Carbon Handlebar', price: 1080.7, sellDate: '2025-10-24', sellTime: '22:58', inStock: false },
{ model: 'Aero Bottle', price: 1571.13, sellDate: '2025-05-24', sellTime: '00:24', inStock: true },
{ model: 'Windbreaker Jacket', price: 919.09, sellDate: '2025-07-16', sellTime: '19:11', inStock: true },
{ model: 'HL Road Tire', price: 886.22, sellDate: '2025-09-09', sellTime: '00:42', inStock: false },
{ model: 'Speed Gloves', price: 635.13, sellDate: '2025-11-17', sellTime: '12:45', inStock: true },
{ model: 'Trail Helmet', price: 1440.64, sellDate: '2025-01-03', sellTime: '20:16', inStock: false },
{ model: 'Aero Bottle', price: 944.63, sellDate: '2025-11-15', sellTime: '16:14', inStock: false },
{ model: 'Windbreaker Jacket', price: 1161.43, sellDate: '2025-06-24', sellTime: '13:19', inStock: false },
{ model: 'LED Bike Light', price: 1012.5, sellDate: '2025-05-01', sellTime: '17:30', inStock: false },
{ model: 'Windbreaker Jacket', price: 635.37, sellDate: '2025-05-14', sellTime: '09:05', inStock: true },
{ model: 'Road Tire Tube', price: 1421.27, sellDate: '2025-01-31', sellTime: '13:33', inStock: true },
{ model: 'Action Camera', price: 1019.05, sellDate: '2025-12-07', sellTime: '01:26', inStock: false },
{ model: 'Carbon Handlebar', price: 603.96, sellDate: '2025-09-13', sellTime: '04:10', inStock: false },
];
const backgroundOptions = [
{ value: 'solid', label: 'Solid' },
{ value: 'semi-transparent', label: 'Semi-transparent' },
];
const ExampleComponent = () => {
const hotTableRef = useRef(null);
const [isOpen, setIsOpen] = useState(false);
const [selected, setSelected] = useState('solid');
const dropdownRef = useRef(null);
useEffect(() => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
hotInstance.getPlugin('dialog').show();
}, []);
useEffect(() => {
const handleClickOutside = (e) => {
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
setIsOpen(false);
}
};
const handleEscape = (e) => {
if (e.key === 'Escape') setIsOpen(false);
};
document.addEventListener('click', handleClickOutside);
document.addEventListener('keydown', handleEscape);
return () => {
document.removeEventListener('click', handleClickOutside);
document.removeEventListener('keydown', handleEscape);
};
}, []);
const handleSelect = (value) => {
setSelected(value);
setIsOpen(false);
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
const content =
value === 'solid'
? 'This dialog uses a solid background (default).'
: 'This dialog uses a semi-transparent background.';
hotInstance.getPlugin('dialog').update({ content, background: value });
};
return (
<>
<div className="example-controls-container">
<div className="controls">
<div className="theme-dropdown" ref={dropdownRef}>
<button
className="theme-dropdown-trigger"
type="button"
aria-haspopup="listbox"
aria-expanded={isOpen}
onClick={() => setIsOpen(!isOpen)}
>
<span>{backgroundOptions.find((o) => o.value === selected)?.label}</span>
<svg className="theme-dropdown-chevron" aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M6 9l6 6l6 -6"/></svg>
</button>
{isOpen && (
<ul className="theme-dropdown-menu" role="listbox">
{backgroundOptions.map((opt) => (
<li key={opt.value} role="option" aria-selected={selected === opt.value} onClick={() => handleSelect(opt.value)}>
{opt.label}
</li>
))}
</ul>
)}
</div>
</div>
</div>
<HotTable
ref={hotTableRef}
data={data}
width="100%"
height={300}
stretchH="all"
contextMenu={true}
rowHeaders={true}
colHeaders={true}
autoWrapRow={true}
autoWrapCol={true}
autoRowSize={true}
dialog={{
content: 'This dialog uses a solid background (default).',
background: 'solid',
closable: true,
}}
licenseKey="non-commercial-and-evaluation"
>
<HotColumn title="Model" type="text" data="model" width={150} headerClassName="htLeft" />
<HotColumn
title="Price"
type="numeric"
data="price"
width={80}
locale="en-US"
numericFormat={{ style: 'currency', currency: 'USD', minimumFractionDigits: 2 }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Date"
type="intl-date"
data="sellDate"
width={131}
locale="en-US"
dateFormat={{ month: 'short', day: 'numeric', year: 'numeric' }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Time"
type="intl-time"
data="sellTime"
width={90}
timeFormat={{ hour: '2-digit', minute: '2-digit', hour12: true }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn title="In stock" type="checkbox" data="inStock" className="htCenter" headerClassName="htCenter" />
</HotTable>
</>
);
};
export default ExampleComponent;
TypeScript
import React, { useRef, useEffect, useState } from 'react';
import { HotTable, HotColumn } from '@handsontable/react-wrapper';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const data = [
{ model: 'Trail Helmet', price: 1298.14, sellDate: '2025-08-31', sellTime: '14:12', inStock: true },
{ model: 'Windbreaker Jacket', price: 178.9, sellDate: '2025-05-10', sellTime: '22:26', inStock: false },
{ model: 'Cycling Cap', price: 288.1, sellDate: '2025-09-15', sellTime: '09:37', inStock: true },
{ model: 'HL Mountain Frame', price: 94.49, sellDate: '2025-01-17', sellTime: '14:19', inStock: false },
{ model: 'Racing Socks', price: 430.38, sellDate: '2025-05-10', sellTime: '13:42', inStock: true },
{ model: 'Racing Socks', price: 138.85, sellDate: '2025-09-20', sellTime: '14:48', inStock: true },
{ model: 'HL Mountain Frame', price: 1909.63, sellDate: '2025-09-05', sellTime: '09:35', inStock: false },
{ model: 'Carbon Handlebar', price: 1080.7, sellDate: '2025-10-24', sellTime: '22:58', inStock: false },
{ model: 'Aero Bottle', price: 1571.13, sellDate: '2025-05-24', sellTime: '00:24', inStock: true },
{ model: 'Windbreaker Jacket', price: 919.09, sellDate: '2025-07-16', sellTime: '19:11', inStock: true },
{ model: 'HL Road Tire', price: 886.22, sellDate: '2025-09-09', sellTime: '00:42', inStock: false },
{ model: 'Speed Gloves', price: 635.13, sellDate: '2025-11-17', sellTime: '12:45', inStock: true },
{ model: 'Trail Helmet', price: 1440.64, sellDate: '2025-01-03', sellTime: '20:16', inStock: false },
{ model: 'Aero Bottle', price: 944.63, sellDate: '2025-11-15', sellTime: '16:14', inStock: false },
{ model: 'Windbreaker Jacket', price: 1161.43, sellDate: '2025-06-24', sellTime: '13:19', inStock: false },
{ model: 'LED Bike Light', price: 1012.5, sellDate: '2025-05-01', sellTime: '17:30', inStock: false },
{ model: 'Windbreaker Jacket', price: 635.37, sellDate: '2025-05-14', sellTime: '09:05', inStock: true },
{ model: 'Road Tire Tube', price: 1421.27, sellDate: '2025-01-31', sellTime: '13:33', inStock: true },
{ model: 'Action Camera', price: 1019.05, sellDate: '2025-12-07', sellTime: '01:26', inStock: false },
{ model: 'Carbon Handlebar', price: 603.96, sellDate: '2025-09-13', sellTime: '04:10', inStock: false },
];
const backgroundOptions = [
{ value: 'solid', label: 'Solid' },
{ value: 'semi-transparent', label: 'Semi-transparent' },
];
const ExampleComponent = () => {
const hotTableRef = useRef(null);
const [isOpen, setIsOpen] = useState(false);
const [selected, setSelected] = useState('solid');
const dropdownRef = useRef<HTMLDivElement>(null);
useEffect(() => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
hotInstance.getPlugin('dialog').show();
}, []);
useEffect(() => {
const handleClickOutside = (e: MouseEvent) => {
if (dropdownRef.current && !dropdownRef.current.contains(e.target as Node)) {
setIsOpen(false);
}
};
const handleEscape = (e: KeyboardEvent) => {
if (e.key === 'Escape') setIsOpen(false);
};
document.addEventListener('click', handleClickOutside);
document.addEventListener('keydown', handleEscape);
return () => {
document.removeEventListener('click', handleClickOutside);
document.removeEventListener('keydown', handleEscape);
};
}, []);
const handleSelect = (value: string) => {
setSelected(value);
setIsOpen(false);
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
const content =
value === 'solid'
? 'This dialog uses a solid background (default).'
: 'This dialog uses a semi-transparent background.';
hotInstance.getPlugin('dialog').update({ content, background: value });
};
return (
<>
<div className="example-controls-container">
<div className="controls">
<div className="theme-dropdown" ref={dropdownRef}>
<button
className="theme-dropdown-trigger"
type="button"
aria-haspopup="listbox"
aria-expanded={isOpen}
onClick={() => setIsOpen(!isOpen)}
>
<span>{backgroundOptions.find((o) => o.value === selected)?.label}</span>
<svg className="theme-dropdown-chevron" aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M6 9l6 6l6 -6"/></svg>
</button>
{isOpen && (
<ul className="theme-dropdown-menu" role="listbox">
{backgroundOptions.map((opt) => (
<li key={opt.value} role="option" aria-selected={selected === opt.value} onClick={() => handleSelect(opt.value)}>
{opt.label}
</li>
))}
</ul>
)}
</div>
</div>
</div>
<HotTable
ref={hotTableRef}
data={data}
width="100%"
height={300}
stretchH="all"
contextMenu={true}
rowHeaders={true}
colHeaders={true}
autoWrapRow={true}
autoWrapCol={true}
autoRowSize={true}
dialog={{
content: 'This dialog uses a solid background (default).',
background: 'solid',
closable: true,
}}
licenseKey="non-commercial-and-evaluation"
>
<HotColumn title="Model" type="text" data="model" width={150} headerClassName="htLeft" />
<HotColumn
title="Price"
type="numeric"
data="price"
width={80}
locale="en-US" numericFormat={{ style: 'currency', currency: 'USD', minimumFractionDigits: 2 }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Date"
type="intl-date"
data="sellDate"
width={131}
locale="en-US" dateFormat={{ month: 'short', day: 'numeric', year: 'numeric' }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Time"
type="intl-time"
data="sellTime"
width={90}
timeFormat={{ hour: '2-digit', minute: '2-digit', hour12: true }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn title="In stock" type="checkbox" data="inStock" className="htCenter" headerClassName="htCenter" />
</HotTable>
</>
);
};
export default ExampleComponent;

Content background

The dialog content can have a background color using the contentBackground option.

JavaScript
import React, { useRef, useEffect } from 'react';
import { HotTable, HotColumn } from '@handsontable/react-wrapper';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const data = [
{ model: 'Trail Helmet', price: 1298.14, sellDate: '2025-08-31', sellTime: '14:12', inStock: true },
{ model: 'Windbreaker Jacket', price: 178.9, sellDate: '2025-05-10', sellTime: '22:26', inStock: false },
{ model: 'Cycling Cap', price: 288.1, sellDate: '2025-09-15', sellTime: '09:37', inStock: true },
{ model: 'HL Mountain Frame', price: 94.49, sellDate: '2025-01-17', sellTime: '14:19', inStock: false },
{ model: 'Racing Socks', price: 430.38, sellDate: '2025-05-10', sellTime: '13:42', inStock: true },
{ model: 'Racing Socks', price: 138.85, sellDate: '2025-09-20', sellTime: '14:48', inStock: true },
{ model: 'HL Mountain Frame', price: 1909.63, sellDate: '2025-09-05', sellTime: '09:35', inStock: false },
{ model: 'Carbon Handlebar', price: 1080.7, sellDate: '2025-10-24', sellTime: '22:58', inStock: false },
{ model: 'Aero Bottle', price: 1571.13, sellDate: '2025-05-24', sellTime: '00:24', inStock: true },
{ model: 'Windbreaker Jacket', price: 919.09, sellDate: '2025-07-16', sellTime: '19:11', inStock: true },
{ model: 'HL Road Tire', price: 886.22, sellDate: '2025-09-09', sellTime: '00:42', inStock: false },
{ model: 'Speed Gloves', price: 635.13, sellDate: '2025-11-17', sellTime: '12:45', inStock: true },
{ model: 'Trail Helmet', price: 1440.64, sellDate: '2025-01-03', sellTime: '20:16', inStock: false },
{ model: 'Aero Bottle', price: 944.63, sellDate: '2025-11-15', sellTime: '16:14', inStock: false },
{ model: 'Windbreaker Jacket', price: 1161.43, sellDate: '2025-06-24', sellTime: '13:19', inStock: false },
{ model: 'LED Bike Light', price: 1012.5, sellDate: '2025-05-01', sellTime: '17:30', inStock: false },
{ model: 'Windbreaker Jacket', price: 635.37, sellDate: '2025-05-14', sellTime: '09:05', inStock: true },
{ model: 'Road Tire Tube', price: 1421.27, sellDate: '2025-01-31', sellTime: '13:33', inStock: true },
{ model: 'Action Camera', price: 1019.05, sellDate: '2025-12-07', sellTime: '01:26', inStock: false },
{ model: 'Carbon Handlebar', price: 603.96, sellDate: '2025-09-13', sellTime: '04:10', inStock: false },
];
const ExampleComponent = () => {
const hotTableRef = useRef(null);
useEffect(() => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
hotInstance.getPlugin('dialog').show();
}, []);
return (
<HotTable
ref={hotTableRef}
data={data}
width="100%"
height={300}
stretchH="all"
contextMenu={true}
rowHeaders={true}
colHeaders={true}
autoWrapRow={true}
autoWrapCol={true}
autoRowSize={true}
dialog={{
content: 'This dialog uses a semi-transparent and content background.',
contentBackground: true,
background: 'semi-transparent',
closable: true,
}}
licenseKey="non-commercial-and-evaluation"
>
<HotColumn title="Model" type="text" data="model" width={150} headerClassName="htLeft" />
<HotColumn
title="Price"
type="numeric"
data="price"
width={80}
locale="en-US"
numericFormat={{ style: 'currency', currency: 'USD', minimumFractionDigits: 2 }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Date"
type="intl-date"
data="sellDate"
width={131}
locale="en-US"
dateFormat={{ month: 'short', day: 'numeric', year: 'numeric' }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Time"
type="intl-time"
data="sellTime"
width={90}
timeFormat={{ hour: '2-digit', minute: '2-digit', hour12: true }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn title="In stock" type="checkbox" data="inStock" className="htCenter" headerClassName="htCenter" />
</HotTable>
);
};
export default ExampleComponent;
TypeScript
import React, { useRef, useEffect } from 'react';
import { HotTable, HotColumn } from '@handsontable/react-wrapper';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const data = [
{ model: 'Trail Helmet', price: 1298.14, sellDate: '2025-08-31', sellTime: '14:12', inStock: true },
{ model: 'Windbreaker Jacket', price: 178.9, sellDate: '2025-05-10', sellTime: '22:26', inStock: false },
{ model: 'Cycling Cap', price: 288.1, sellDate: '2025-09-15', sellTime: '09:37', inStock: true },
{ model: 'HL Mountain Frame', price: 94.49, sellDate: '2025-01-17', sellTime: '14:19', inStock: false },
{ model: 'Racing Socks', price: 430.38, sellDate: '2025-05-10', sellTime: '13:42', inStock: true },
{ model: 'Racing Socks', price: 138.85, sellDate: '2025-09-20', sellTime: '14:48', inStock: true },
{ model: 'HL Mountain Frame', price: 1909.63, sellDate: '2025-09-05', sellTime: '09:35', inStock: false },
{ model: 'Carbon Handlebar', price: 1080.7, sellDate: '2025-10-24', sellTime: '22:58', inStock: false },
{ model: 'Aero Bottle', price: 1571.13, sellDate: '2025-05-24', sellTime: '00:24', inStock: true },
{ model: 'Windbreaker Jacket', price: 919.09, sellDate: '2025-07-16', sellTime: '19:11', inStock: true },
{ model: 'HL Road Tire', price: 886.22, sellDate: '2025-09-09', sellTime: '00:42', inStock: false },
{ model: 'Speed Gloves', price: 635.13, sellDate: '2025-11-17', sellTime: '12:45', inStock: true },
{ model: 'Trail Helmet', price: 1440.64, sellDate: '2025-01-03', sellTime: '20:16', inStock: false },
{ model: 'Aero Bottle', price: 944.63, sellDate: '2025-11-15', sellTime: '16:14', inStock: false },
{ model: 'Windbreaker Jacket', price: 1161.43, sellDate: '2025-06-24', sellTime: '13:19', inStock: false },
{ model: 'LED Bike Light', price: 1012.5, sellDate: '2025-05-01', sellTime: '17:30', inStock: false },
{ model: 'Windbreaker Jacket', price: 635.37, sellDate: '2025-05-14', sellTime: '09:05', inStock: true },
{ model: 'Road Tire Tube', price: 1421.27, sellDate: '2025-01-31', sellTime: '13:33', inStock: true },
{ model: 'Action Camera', price: 1019.05, sellDate: '2025-12-07', sellTime: '01:26', inStock: false },
{ model: 'Carbon Handlebar', price: 603.96, sellDate: '2025-09-13', sellTime: '04:10', inStock: false },
];
const ExampleComponent = () => {
const hotTableRef = useRef(null);
useEffect(() => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
hotInstance.getPlugin('dialog').show();
}, []);
return (
<HotTable
ref={hotTableRef}
data={data}
width="100%"
height={300}
stretchH="all"
contextMenu={true}
rowHeaders={true}
colHeaders={true}
autoWrapRow={true}
autoWrapCol={true}
autoRowSize={true}
dialog={{
content: 'This dialog uses a semi-transparent and content background.',
contentBackground: true,
background: 'semi-transparent',
closable: true,
}}
licenseKey="non-commercial-and-evaluation"
>
<HotColumn title="Model" type="text" data="model" width={150} headerClassName="htLeft" />
<HotColumn
title="Price"
type="numeric"
data="price"
width={80}
locale="en-US" numericFormat={{ style: 'currency', currency: 'USD', minimumFractionDigits: 2 }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Date"
type="intl-date"
data="sellDate"
width={131}
locale="en-US" dateFormat={{ month: 'short', day: 'numeric', year: 'numeric' }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Time"
type="intl-time"
data="sellTime"
width={90}
timeFormat={{ hour: '2-digit', minute: '2-digit', hour12: true }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn title="In stock" type="checkbox" data="inStock" className="htCenter" headerClassName="htCenter" />
</HotTable>
);
};
export default ExampleComponent;

Dialog accessibility

The dialog plugin provides accessibility features through ARIA attributes. You can configure the dialog’s accessibility properties using the a11y option, which includes:

  • role - Sets the ARIA role (defaults to “dialog”)
  • ariaLabel - Sets the dialog’s accessible name (defaults to “Dialog”). This is used when there is no visible dialog title that can be referenced by ariaLabelledby. If both ariaLabel and ariaLabelledby are provided, ariaLabelledby takes precedence
  • ariaLabelledby - References an element that labels the dialog
  • ariaDescribedby - References an element that describes the dialog
JavaScript
import React, { useRef, useEffect } from 'react';
import { HotTable, HotColumn } from '@handsontable/react-wrapper';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const data = [
{ model: 'Trail Helmet', price: 1298.14, sellDate: '2025-08-31', sellTime: '14:12', inStock: true },
{ model: 'Windbreaker Jacket', price: 178.9, sellDate: '2025-05-10', sellTime: '22:26', inStock: false },
{ model: 'Cycling Cap', price: 288.1, sellDate: '2025-09-15', sellTime: '09:37', inStock: true },
{ model: 'HL Mountain Frame', price: 94.49, sellDate: '2025-01-17', sellTime: '14:19', inStock: false },
{ model: 'Racing Socks', price: 430.38, sellDate: '2025-05-10', sellTime: '13:42', inStock: true },
{ model: 'Racing Socks', price: 138.85, sellDate: '2025-09-20', sellTime: '14:48', inStock: true },
{ model: 'HL Mountain Frame', price: 1909.63, sellDate: '2025-09-05', sellTime: '09:35', inStock: false },
{ model: 'Carbon Handlebar', price: 1080.7, sellDate: '2025-10-24', sellTime: '22:58', inStock: false },
{ model: 'Aero Bottle', price: 1571.13, sellDate: '2025-05-24', sellTime: '00:24', inStock: true },
{ model: 'Windbreaker Jacket', price: 919.09, sellDate: '2025-07-16', sellTime: '19:11', inStock: true },
{ model: 'HL Road Tire', price: 886.22, sellDate: '2025-09-09', sellTime: '00:42', inStock: false },
{ model: 'Speed Gloves', price: 635.13, sellDate: '2025-11-17', sellTime: '12:45', inStock: true },
{ model: 'Trail Helmet', price: 1440.64, sellDate: '2025-01-03', sellTime: '20:16', inStock: false },
{ model: 'Aero Bottle', price: 944.63, sellDate: '2025-11-15', sellTime: '16:14', inStock: false },
{ model: 'Windbreaker Jacket', price: 1161.43, sellDate: '2025-06-24', sellTime: '13:19', inStock: false },
{ model: 'LED Bike Light', price: 1012.5, sellDate: '2025-05-01', sellTime: '17:30', inStock: false },
{ model: 'Windbreaker Jacket', price: 635.37, sellDate: '2025-05-14', sellTime: '09:05', inStock: true },
{ model: 'Road Tire Tube', price: 1421.27, sellDate: '2025-01-31', sellTime: '13:33', inStock: true },
{ model: 'Action Camera', price: 1019.05, sellDate: '2025-12-07', sellTime: '01:26', inStock: false },
{ model: 'Carbon Handlebar', price: 603.96, sellDate: '2025-09-13', sellTime: '04:10', inStock: false },
];
const ExampleComponent = () => {
const hotTableRef = useRef(null);
useEffect(() => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
hotInstance.getPlugin('dialog').show();
}, []);
return (
<HotTable
ref={hotTableRef}
data={data}
width="100%"
height={300}
stretchH="all"
contextMenu={true}
rowHeaders={true}
colHeaders={true}
autoWrapRow={true}
autoWrapCol={true}
autoRowSize={true}
dialog={{
content: '<h2 id="example6-title">Title</h2><p id="example6-description">Description</p>',
a11y: {
role: 'alertdialog',
ariaLabel: 'Title',
ariaLabelledby: 'example6-title',
ariaDescribedby: 'example6-description',
},
closable: true,
}}
licenseKey="non-commercial-and-evaluation"
>
<HotColumn title="Model" type="text" data="model" width={150} headerClassName="htLeft" />
<HotColumn
title="Price"
type="numeric"
data="price"
width={80}
locale="en-US"
numericFormat={{ style: 'currency', currency: 'USD', minimumFractionDigits: 2 }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Date"
type="intl-date"
data="sellDate"
width={131}
locale="en-US"
dateFormat={{ month: 'short', day: 'numeric', year: 'numeric' }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Time"
type="intl-time"
data="sellTime"
width={90}
timeFormat={{ hour: '2-digit', minute: '2-digit', hour12: true }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn title="In stock" type="checkbox" data="inStock" className="htCenter" headerClassName="htCenter" />
</HotTable>
);
};
export default ExampleComponent;
TypeScript
import React, { useRef, useEffect } from 'react';
import { HotTable, HotColumn } from '@handsontable/react-wrapper';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const data = [
{ model: 'Trail Helmet', price: 1298.14, sellDate: '2025-08-31', sellTime: '14:12', inStock: true },
{ model: 'Windbreaker Jacket', price: 178.9, sellDate: '2025-05-10', sellTime: '22:26', inStock: false },
{ model: 'Cycling Cap', price: 288.1, sellDate: '2025-09-15', sellTime: '09:37', inStock: true },
{ model: 'HL Mountain Frame', price: 94.49, sellDate: '2025-01-17', sellTime: '14:19', inStock: false },
{ model: 'Racing Socks', price: 430.38, sellDate: '2025-05-10', sellTime: '13:42', inStock: true },
{ model: 'Racing Socks', price: 138.85, sellDate: '2025-09-20', sellTime: '14:48', inStock: true },
{ model: 'HL Mountain Frame', price: 1909.63, sellDate: '2025-09-05', sellTime: '09:35', inStock: false },
{ model: 'Carbon Handlebar', price: 1080.7, sellDate: '2025-10-24', sellTime: '22:58', inStock: false },
{ model: 'Aero Bottle', price: 1571.13, sellDate: '2025-05-24', sellTime: '00:24', inStock: true },
{ model: 'Windbreaker Jacket', price: 919.09, sellDate: '2025-07-16', sellTime: '19:11', inStock: true },
{ model: 'HL Road Tire', price: 886.22, sellDate: '2025-09-09', sellTime: '00:42', inStock: false },
{ model: 'Speed Gloves', price: 635.13, sellDate: '2025-11-17', sellTime: '12:45', inStock: true },
{ model: 'Trail Helmet', price: 1440.64, sellDate: '2025-01-03', sellTime: '20:16', inStock: false },
{ model: 'Aero Bottle', price: 944.63, sellDate: '2025-11-15', sellTime: '16:14', inStock: false },
{ model: 'Windbreaker Jacket', price: 1161.43, sellDate: '2025-06-24', sellTime: '13:19', inStock: false },
{ model: 'LED Bike Light', price: 1012.5, sellDate: '2025-05-01', sellTime: '17:30', inStock: false },
{ model: 'Windbreaker Jacket', price: 635.37, sellDate: '2025-05-14', sellTime: '09:05', inStock: true },
{ model: 'Road Tire Tube', price: 1421.27, sellDate: '2025-01-31', sellTime: '13:33', inStock: true },
{ model: 'Action Camera', price: 1019.05, sellDate: '2025-12-07', sellTime: '01:26', inStock: false },
{ model: 'Carbon Handlebar', price: 603.96, sellDate: '2025-09-13', sellTime: '04:10', inStock: false },
];
const ExampleComponent = () => {
const hotTableRef = useRef(null);
useEffect(() => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
hotInstance.getPlugin('dialog').show();
}, []);
return (
<HotTable
ref={hotTableRef}
data={data}
width="100%"
height={300}
stretchH="all"
contextMenu={true}
rowHeaders={true}
colHeaders={true}
autoWrapRow={true}
autoWrapCol={true}
autoRowSize={true}
dialog={{
content: '<h2 id="example6-title">Title</h2><p id="example6-description">Description</p>',
a11y: {
role: 'alertdialog',
ariaLabel: 'Title',
ariaLabelledby: 'example6-title',
ariaDescribedby: 'example6-description',
},
closable: true,
}}
licenseKey="non-commercial-and-evaluation"
>
<HotColumn title="Model" type="text" data="model" width={150} headerClassName="htLeft" />
<HotColumn
title="Price"
type="numeric"
data="price"
width={80}
locale="en-US" numericFormat={{ style: 'currency', currency: 'USD', minimumFractionDigits: 2 }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Date"
type="intl-date"
data="sellDate"
width={131}
locale="en-US" dateFormat={{ month: 'short', day: 'numeric', year: 'numeric' }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Time"
type="intl-time"
data="sellTime"
width={90}
timeFormat={{ hour: '2-digit', minute: '2-digit', hour12: true }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn title="In stock" type="checkbox" data="inStock" className="htCenter" headerClassName="htCenter" />
</HotTable>
);
};
export default ExampleComponent;

Programmatic control

You can control the dialog programmatically using the plugin’s methods.

Show and hide dialog

JavaScript
import React, { useRef } from 'react';
import { HotTable, HotColumn } from '@handsontable/react-wrapper';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const data = [
{ model: 'Trail Helmet', price: 1298.14, sellDate: '2025-08-31', sellTime: '14:12', inStock: true },
{ model: 'Windbreaker Jacket', price: 178.9, sellDate: '2025-05-10', sellTime: '22:26', inStock: false },
{ model: 'Cycling Cap', price: 288.1, sellDate: '2025-09-15', sellTime: '09:37', inStock: true },
{ model: 'HL Mountain Frame', price: 94.49, sellDate: '2025-01-17', sellTime: '14:19', inStock: false },
{ model: 'Racing Socks', price: 430.38, sellDate: '2025-05-10', sellTime: '13:42', inStock: true },
{ model: 'Racing Socks', price: 138.85, sellDate: '2025-09-20', sellTime: '14:48', inStock: true },
{ model: 'HL Mountain Frame', price: 1909.63, sellDate: '2025-09-05', sellTime: '09:35', inStock: false },
{ model: 'Carbon Handlebar', price: 1080.7, sellDate: '2025-10-24', sellTime: '22:58', inStock: false },
{ model: 'Aero Bottle', price: 1571.13, sellDate: '2025-05-24', sellTime: '00:24', inStock: true },
{ model: 'Windbreaker Jacket', price: 919.09, sellDate: '2025-07-16', sellTime: '19:11', inStock: true },
{ model: 'HL Road Tire', price: 886.22, sellDate: '2025-09-09', sellTime: '00:42', inStock: false },
{ model: 'Speed Gloves', price: 635.13, sellDate: '2025-11-17', sellTime: '12:45', inStock: true },
{ model: 'Trail Helmet', price: 1440.64, sellDate: '2025-01-03', sellTime: '20:16', inStock: false },
{ model: 'Aero Bottle', price: 944.63, sellDate: '2025-11-15', sellTime: '16:14', inStock: false },
{ model: 'Windbreaker Jacket', price: 1161.43, sellDate: '2025-06-24', sellTime: '13:19', inStock: false },
{ model: 'LED Bike Light', price: 1012.5, sellDate: '2025-05-01', sellTime: '17:30', inStock: false },
{ model: 'Windbreaker Jacket', price: 635.37, sellDate: '2025-05-14', sellTime: '09:05', inStock: true },
{ model: 'Road Tire Tube', price: 1421.27, sellDate: '2025-01-31', sellTime: '13:33', inStock: true },
{ model: 'Action Camera', price: 1019.05, sellDate: '2025-12-07', sellTime: '01:26', inStock: false },
{ model: 'Carbon Handlebar', price: 603.96, sellDate: '2025-09-13', sellTime: '04:10', inStock: false },
];
const ExampleComponent = () => {
const hotTableRef = useRef(null);
const showDialog = () => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
hotInstance.getPlugin('dialog').show();
};
const hideDialog = () => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
hotInstance.getPlugin('dialog').hide();
};
return (
<>
<div style={{ marginBottom: '16px', display: 'flex', gap: '10px' }}>
<button onClick={showDialog}>Show Dialog</button>
<button onClick={hideDialog}>Hide Dialog</button>
</div>
<HotTable
ref={hotTableRef}
data={data}
width="100%"
height={300}
stretchH="all"
contextMenu={true}
rowHeaders={true}
colHeaders={true}
autoWrapRow={true}
autoWrapCol={true}
autoRowSize={true}
dialog={{
content: 'This dialog can be controlled programmatically.',
closable: true,
}}
licenseKey="non-commercial-and-evaluation"
>
<HotColumn title="Model" type="text" data="model" width={150} headerClassName="htLeft" />
<HotColumn
title="Price"
type="numeric"
data="price"
width={80}
locale="en-US"
numericFormat={{ style: 'currency', currency: 'USD', minimumFractionDigits: 2 }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Date"
type="intl-date"
data="sellDate"
width={131}
locale="en-US"
dateFormat={{ month: 'short', day: 'numeric', year: 'numeric' }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Time"
type="intl-time"
data="sellTime"
width={90}
timeFormat={{ hour: '2-digit', minute: '2-digit', hour12: true }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn title="In stock" type="checkbox" data="inStock" className="htCenter" headerClassName="htCenter" />
</HotTable>
</>
);
};
export default ExampleComponent;
TypeScript
import React, { useRef } from 'react';
import { HotTable, HotColumn, HotTableRef } from '@handsontable/react-wrapper';
import { registerAllModules } from 'handsontable/registry';
// register Handsontable's modules
registerAllModules();
const data = [
{ model: 'Trail Helmet', price: 1298.14, sellDate: '2025-08-31', sellTime: '14:12', inStock: true },
{ model: 'Windbreaker Jacket', price: 178.9, sellDate: '2025-05-10', sellTime: '22:26', inStock: false },
{ model: 'Cycling Cap', price: 288.1, sellDate: '2025-09-15', sellTime: '09:37', inStock: true },
{ model: 'HL Mountain Frame', price: 94.49, sellDate: '2025-01-17', sellTime: '14:19', inStock: false },
{ model: 'Racing Socks', price: 430.38, sellDate: '2025-05-10', sellTime: '13:42', inStock: true },
{ model: 'Racing Socks', price: 138.85, sellDate: '2025-09-20', sellTime: '14:48', inStock: true },
{ model: 'HL Mountain Frame', price: 1909.63, sellDate: '2025-09-05', sellTime: '09:35', inStock: false },
{ model: 'Carbon Handlebar', price: 1080.7, sellDate: '2025-10-24', sellTime: '22:58', inStock: false },
{ model: 'Aero Bottle', price: 1571.13, sellDate: '2025-05-24', sellTime: '00:24', inStock: true },
{ model: 'Windbreaker Jacket', price: 919.09, sellDate: '2025-07-16', sellTime: '19:11', inStock: true },
{ model: 'HL Road Tire', price: 886.22, sellDate: '2025-09-09', sellTime: '00:42', inStock: false },
{ model: 'Speed Gloves', price: 635.13, sellDate: '2025-11-17', sellTime: '12:45', inStock: true },
{ model: 'Trail Helmet', price: 1440.64, sellDate: '2025-01-03', sellTime: '20:16', inStock: false },
{ model: 'Aero Bottle', price: 944.63, sellDate: '2025-11-15', sellTime: '16:14', inStock: false },
{ model: 'Windbreaker Jacket', price: 1161.43, sellDate: '2025-06-24', sellTime: '13:19', inStock: false },
{ model: 'LED Bike Light', price: 1012.5, sellDate: '2025-05-01', sellTime: '17:30', inStock: false },
{ model: 'Windbreaker Jacket', price: 635.37, sellDate: '2025-05-14', sellTime: '09:05', inStock: true },
{ model: 'Road Tire Tube', price: 1421.27, sellDate: '2025-01-31', sellTime: '13:33', inStock: true },
{ model: 'Action Camera', price: 1019.05, sellDate: '2025-12-07', sellTime: '01:26', inStock: false },
{ model: 'Carbon Handlebar', price: 603.96, sellDate: '2025-09-13', sellTime: '04:10', inStock: false },
];
const ExampleComponent = () => {
const hotTableRef = useRef<HotTableRef>(null);
const showDialog = () => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
hotInstance.getPlugin('dialog').show();
};
const hideDialog = () => {
const hotInstance = hotTableRef.current?.hotInstance;
if (!hotInstance) {
return;
}
hotInstance.getPlugin('dialog').hide();
};
return (
<>
<div style={{ marginBottom: '16px', display: 'flex', gap: '10px' }}>
<button onClick={showDialog}>Show Dialog</button>
<button onClick={hideDialog}>Hide Dialog</button>
</div>
<HotTable
ref={hotTableRef}
data={data}
width="100%"
height={300}
stretchH="all"
contextMenu={true}
rowHeaders={true}
colHeaders={true}
autoWrapRow={true}
autoWrapCol={true}
autoRowSize={true}
dialog={{
content: 'This dialog can be controlled programmatically.',
closable: true,
}}
licenseKey="non-commercial-and-evaluation"
>
<HotColumn title="Model" type="text" data="model" width={150} headerClassName="htLeft" />
<HotColumn
title="Price"
type="numeric"
data="price"
width={80}
locale="en-US" numericFormat={{ style: 'currency', currency: 'USD', minimumFractionDigits: 2 }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Date"
type="intl-date"
data="sellDate"
width={131}
locale="en-US" dateFormat={{ month: 'short', day: 'numeric', year: 'numeric' }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn
title="Time"
type="intl-time"
data="sellTime"
width={90}
timeFormat={{ hour: '2-digit', minute: '2-digit', hour12: true }}
className="htRight"
headerClassName="htRight"
/>
<HotColumn title="In stock" type="checkbox" data="inStock" className="htCenter" headerClassName="htCenter" />
</HotTable>
</>
);
};
export default ExampleComponent;

Configuration options

Plugins