Git Product home page Git Product logo

react-handsontable's Introduction

react-handsontable Build Status

A React wrapper for the the Handsontable spreadsheet component.

Table of contents

  1. Installation
  2. Building
  3. Basic usage
  4. Examples
  5. License
  6. Contact
  7. Other wrappers

Installation

To install the component, use npm:

npm install react-handsontable

Note, that to use Handsontable within React, you'll have to install the handsontable package as well:

npm install handsontable

Building

If you used npm to download the library, you should be good to go, but if you want to make a build yourself, go to the directory where react-handsontable source is located and run:

npm run build

This will create a /dist/ directory with react-handsontable.js and react-handsontable.min.js for you to use.

Basic usage

react-handsontable creates a <HotTable> component. You can use it just like any other React component. For example:

// import React...
import React from 'react';
import ReactDOM from 'react-dom';

// ... Handsontable with its main dependencies...
import moment from 'moment';
import numbro from 'numbro';
import pikaday from 'pikaday';
import Zeroclipboard from 'zeroclipboard';
import Handsontable from 'handsontable';

// ... and HotTable
import HotTable from 'react-handsontable';

class ExampleComponent extends React.Component {
  constructor(props) {
    super(props);
    this.handsontableData = [
      ["", "Ford", "Volvo", "Toyota", "Honda"],
      ["2016", 10, 11, 12, 13],
      ["2017", 20, 11, 14, 13],
      ["2018", 30, 15, 12, 13]
    ];
  }

  render() {
    return (
      <div id="example-component">
        <HotTable root="hot" data={this.handsontableData} colHeaders={true} rowHeaders={true} width="600" height="300" stretchH="all" />
      </div>
    );
  }
}

Note, that you can provide the Handsontable options either as:

  • individual component properties
<HotTable root="hot" data={this.handsontableData} colHeaders={true} rowHeaders={true} width="600" height="300" stretchH="all" />
  • an object passed to a single settings property
<HotTable root="hot" settings={{
    data: this.handsontableData,
    colHeaders: true,
    rowHeaders: true,
    width: 600,
    height: 300,
    stretchH: 'all'
}} />

The root property declares the id of the root element for the table. It is optional - if it isn't provided, the table will get a random generated id.

Examples

License

react-handsontable is released under the MIT license. Copyrights belong to Handsoncode sp. z o.o.

Contact

Feel free to give us feedback on this wrapper using this contact form or write directly at [email protected].

Other Wrappers

Handsontable comes with more wrappers and directives for popular frameworks:

react-handsontable's People

Contributors

jansiegel avatar

Watchers

James Cloos avatar Dênis Vilela avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.