Handsontable example
by Blake Gilchrist
HTML
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/handsontable.full.min.css" />
<script src="https://cdn.jsdelivr.net/npm/react@17/umd/react.production.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/react-dom@17/umd/react-dom.production.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@handsontable/[email protected]/dist/react-handsontable.min.js"></script>
<script src="https://handsontable.com/docs/14.1/scripts/fixer.js"></script>
<div id="example1" class="hot "></div>
Babel + JSX
import { HotTable } from '@handsontable/react';
import { registerAllModules } from 'handsontable/registry';
import 'handsontable/dist/handsontable.full.min.css';
// register Handsontable's modules
registerAllModules();
export const ExampleComponent = () => {
return (
<HotTable
data={[
['Tesla', 2017],
['Nissan', 2018],
['Chrysler', 2019],
['Volvo', 2020]
]}
colHeaders={['Car', 'Year', 'Chassis color', 'Bumper color']}
columns={[
{},
{ type: 'numeric' },
{
type: 'autocomplete',
source: ['yellow', 'red', 'orange', 'green', 'blue', 'gray', 'black', 'a really long colour name'],
trimDropdown: false
},
{
type: 'autocomplete',
source: ['yellow', 'red', 'orange', 'green', 'blue', 'gray', 'black', 'a really long colour name'],
trimDropdown: false
}
]}
autoWrapRow={true}
autoWrapCol={true}
licenseKey="non-commercial-and-evaluation"
/>
);
};
ReactDOM.render(<ExampleComponent />, document.getElementById('example1'));