Convert Figma logo to code with AI

handsontable logohandsontable

JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡

19,743
3,030
19,743
429

Top Related Projects

12,496

The best JavaScript Data Table for building Enterprise Applications. Supports React / Angular / Vue / Plain JavaScript.

A lightning fast JavaScript grid/spreadsheet

24,849

🤖 Headless UI for building powerful tables & datagrids for TS/JS - React-Table, Vue-Table, Solid-Table, Svelte-Table

React components for efficiently rendering large lists and tabular data

Quick Overview

Handsontable is a JavaScript data grid component with spreadsheet-like features. It provides an Excel-like interface for web applications, allowing users to view, edit, and manipulate large datasets directly in the browser. Handsontable is highly customizable and supports various data types, cell types, and advanced features like sorting, filtering, and validation.

Pros

  • Extensive features: Offers a wide range of spreadsheet-like functionalities
  • High performance: Efficiently handles large datasets with smooth scrolling
  • Customizable: Provides numerous options for styling and behavior customization
  • Active development: Regularly updated with new features and bug fixes

Cons

  • Learning curve: Can be complex to set up and configure for advanced use cases
  • Limited free version: Some features are only available in the paid Pro version
  • Performance impact: Heavy customization can affect performance with large datasets
  • Browser compatibility: Some advanced features may not work in older browsers

Code Examples

  1. Basic initialization:
const container = document.getElementById('example');
const hot = new Handsontable(container, {
  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',
  licenseKey: 'non-commercial-and-evaluation'
});
  1. Adding custom cell types:
const container = document.getElementById('example');
const hot = new Handsontable(container, {
  data: [
    ['', 'Price', 'Stock'],
    ['Product A', 10.99, 15],
    ['Product B', 15.99, 8],
    ['Product C', 5.99, 22]
  ],
  columns: [
    {},
    { type: 'numeric', format: '$0,0.00' },
    { type: 'numeric' }
  ],
  licenseKey: 'non-commercial-and-evaluation'
});
  1. Implementing data validation:
const container = document.getElementById('example');
const hot = new Handsontable(container, {
  data: [
    ['', 'Email', 'Password'],
    ['User 1', '', ''],
    ['User 2', '', ''],
    ['User 3', '', '']
  ],
  columns: [
    {},
    {
      validator: (value, callback) => {
        callback(/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value));
      }
    },
    {
      validator: (value, callback) => {
        callback(value.length >= 8);
      }
    }
  ],
  licenseKey: 'non-commercial-and-evaluation'
});

Getting Started

  1. Install Handsontable via npm:

    npm install handsontable
    
  2. Import Handsontable in your JavaScript file:

    import Handsontable from 'handsontable';
    import 'handsontable/dist/handsontable.full.min.css';
    
  3. Create a container element in your HTML:

    <div id="example"></div>
    
  4. Initialize Handsontable:

    const container = document.getElementById('example');
    const hot = new Handsontable(container, {
      data: [['', 'A', 'B'], [1, 'X', 'Y'], [2, 'P', 'Q']],
      rowHeaders: true,
      colHeaders: true,
      licenseKey: 'non-commercial-and-evaluation'
    });
    

Competitor Comparisons

12,496

The best JavaScript Data Table for building Enterprise Applications. Supports React / Angular / Vue / Plain JavaScript.

Pros of ag-grid

  • More extensive feature set, including advanced filtering, sorting, and grouping
  • Better performance with large datasets (100,000+ rows)
  • More customizable with a wider range of themes and styling options

Cons of ag-grid

  • Steeper learning curve due to its complexity
  • More expensive enterprise version for advanced features
  • Larger bundle size, which may impact initial load times

Code Comparison

ag-grid:

import { Grid } from 'ag-grid-community';

const gridOptions = {
  columnDefs: [{ field: 'name' }, { field: 'age' }],
  rowData: [{ name: 'John', age: 30 }, { name: 'Jane', age: 25 }]
};

new Grid(document.querySelector('#myGrid'), gridOptions);

Handsontable:

import Handsontable from 'handsontable';

const hot = new Handsontable(document.getElementById('example'), {
  data: [['John', 30], ['Jane', 25]],
  colHeaders: ['Name', 'Age']
});

Both libraries offer powerful data grid solutions, but ag-grid provides more advanced features and better performance for large datasets. However, this comes at the cost of increased complexity and potentially higher licensing fees. Handsontable, while simpler, may be more suitable for smaller projects or those requiring a gentler learning curve.

A lightning fast JavaScript grid/spreadsheet

Pros of SlickGrid

  • Lightweight and fast, especially for large datasets
  • Highly customizable with extensive plugin system
  • Better support for frozen columns and rows

Cons of SlickGrid

  • Less active development and community support
  • Steeper learning curve due to more complex API
  • Limited built-in features compared to Handsontable

Code Comparison

SlickGrid:

var grid = new Slick.Grid("#myGrid", data, columns, options);
grid.onCellChange.subscribe(function (e, args) {
  // Handle cell change
});

Handsontable:

var hot = new Handsontable(container, {
  data: data,
  columns: columns,
  afterChange: function (changes, source) {
    // Handle cell change
  }
});

Both libraries offer powerful grid functionality, but SlickGrid focuses on performance and customization for large datasets, while Handsontable provides a more user-friendly API with a wider range of built-in features. SlickGrid's event-based approach contrasts with Handsontable's configuration-driven setup, reflecting their different design philosophies.

24,849

🤖 Headless UI for building powerful tables & datagrids for TS/JS - React-Table, Vue-Table, Solid-Table, Svelte-Table

Pros of TanStack Table

  • Lightweight and flexible, with a smaller bundle size
  • Framework-agnostic, supporting React, Vue, Solid, and vanilla JS
  • Highly customizable with a powerful plugin system

Cons of TanStack Table

  • Steeper learning curve due to its headless nature
  • Less out-of-the-box functionality compared to Handsontable
  • Requires more setup and configuration for advanced features

Code Comparison

Handsontable:

const hot = new Handsontable(container, {
  data: data,
  columns: columns,
  rowHeaders: true,
  colHeaders: true
});

TanStack Table:

const table = useReactTable({
  data,
  columns,
  getCoreRowModel: getCoreRowModel()
});

Both libraries offer powerful table functionality, but they cater to different use cases. Handsontable provides a more complete solution with built-in features, while TanStack Table offers greater flexibility and customization options. The choice between them depends on project requirements, development preferences, and the desired level of control over the table implementation.

React components for efficiently rendering large lists and tabular data

Pros of react-virtualized

  • Specialized for rendering large lists and tabular data efficiently
  • Lightweight and focused on virtualization, with a smaller bundle size
  • More flexible for custom UI components and layouts

Cons of react-virtualized

  • Less out-of-the-box features compared to Handsontable
  • Requires more custom implementation for complex spreadsheet-like functionality
  • Steeper learning curve for advanced use cases

Code Comparison

react-virtualized:

import { List } from 'react-virtualized';

<List
  width={300}
  height={300}
  rowCount={1000}
  rowHeight={20}
  rowRenderer={({ key, index, style }) => (
    <div key={key} style={style}>Row {index}</div>
  )}
/>

Handsontable:

import Handsontable from 'handsontable';

const hot = new Handsontable(container, {
  data: [['', 'Tesla', 'Volvo', 'Toyota', 'Ford'],
         ['2019', 10, 11, 12, 13],
         ['2020', 20, 11, 14, 13],
         ['2021', 30, 15, 12, 13]],
  rowHeaders: true,
  colHeaders: true
});

react-virtualized is better suited for efficient rendering of large datasets in custom UIs, while Handsontable provides a more complete spreadsheet-like experience out of the box. The choice depends on specific project requirements and desired level of customization.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Handsontable

Handsontable is a JavaScript component that combines data grid features with spreadsheet-like UX.
It provides data binding, data validation, filtering, sorting, and CRUD operations.

npm npm CI status FOSSA Status Quality Gate Status


Get started with Handsontable

React  Angular  Vue  Vue 3    JavaScript 

Handsontable data grid

Features

The most popular features of Handsontable:

  âœ“  Multiple column sorting
  âœ“  Non-contiguous selection
  âœ“  Filtering data
  âœ“  Export to file
  âœ“  Validating data
  âœ“  Conditional formatting
  âœ“  Merging cells
  âœ“  Freezing rows/columns
  âœ“  Moving rows/columns
  âœ“  Resizing rows/columns
  âœ“  Hiding rows/columns
  âœ“  Context menu
  âœ“  Comments

Documentation

Get started

1. Install Handsontable

Using a package manager

Get Handsontable from npm, Yarn or NuGet.

npm install handsontable
import Handsontable from 'handsontable';

import 'handsontable/dist/handsontable.full.min.css';

Using a CDN

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/handsontable/dist/handsontable.full.min.js"></script>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable/dist/handsontable.full.min.css" />

2. Create a container

<div id="example"></div>

3. Initialize your grid

const container = document.querySelector('#example');
const hot = new Handsontable(container, {
  data: [
    ['', 'Tesla', 'Volvo', 'Toyota', 'Ford'],
    ['2019', 10, 11, 12, 13],
    ['2020', 20, 11, 14, 13],
    ['2021', 30, 15, 12, 13]
  ],
  rowHeaders: true,
  colHeaders: true,
  licenseKey: 'non-commercial-and-evaluation' // for non-commercial use only
});

Support

We provide support for developers working with commercial version via contact form or at support@handsontable.com.

If you use a non-commercial version then please ask your tagged question on StackOverflow.

License

Handsontable is a commercial software with two licenses available:

  • Free for non-commercial purposes such as teaching, academic research, and evaluation. Read it here.
  • Commercial license with support and maintenance included. See pricing plans.

License key

If you use Handsontable in a project that supports your commercial activity, then you must purchase the license key at handsontable.com.

If you use the free for non-commercial license of Handsontable, then pass the phrase 'non-commercial-and-evaluation', as described in this documentation.



Proudly created and maintained by the Handsontable Team.

NPM DownloadsLast 30 Days