react-spreadsheet
Version:
Simple, customizable yet performant spreadsheet for React
97 lines (72 loc) • 3.09 kB
Markdown
<div align="center">
<img src="https://raw.githubusercontent.com/iddan/react-spreadsheet/master/assets/logo.svg?sanitize=true" height="120">
</div>
Simple, customizable yet performant spreadsheet for React.

[](https://app.fossa.io/projects/git%2Bgithub.com%2Fiddan%2Freact-spreadsheet?ref=badge_shield)
[](https://circleci.com/gh/iddan/react-spreadsheet)
[](https://snyk.io/test/github/iddan/react-spreadsheet?targetFile=package.json)
[](https://coveralls.io/github/iddan/react-spreadsheet?branch=master)
```bash
npm install react-spreadsheet
```
_or_
```bash
yarn add react-spreadsheet
```
- Simple straightforward API focusing on common use cases while keeping flexibility
- Performant (yet not virtualized)
- Implements Just Components™
```javascript
import React from "react";
import Spreadsheet from "react-spreadsheet";
const data = [
[{ value: "Vanilla" }, { value: "Chocolate" }],
[{ value: "Strawberry" }, { value: "Cookies" }]
];
const MyComponent = () => <Spreadsheet data={data} />;
```
```javascript
import React from "react";
import Spreadsheet from "react-spreadsheet";
const RangeView = ({ cell, getValue }) => (
<input
type="range"
value={getValue({ data: cell })}
disabled
style={{ pointerEvents: "none" }}
/>
);
const RangeEdit = ({ getValue, cell, onChange }) => (
<input
type="range"
onChange={e => {
onChange({ ...cell, value: e.target.value });
}}
value={getValue({ data: cell }) || 0}
autoFocus
/>
);
const data = [
[{ value: "Flavors" }],
[({ value: "Vanilla" }, { value: "Chocolate" })],
[{ value: "Strawberry" }, { value: "Cookies" }],
[
{ value: "How much do you like ice cream?" },
{ value: 100, DataViewer: RangeView, DataEditor: RangeEdit }
]
];
const MyComponent = () => <Spreadsheet data={data} />;
```
- [React Datasheet](https://nadbm.github.io/react-datasheet/) - Heavily inspired by, enhanced performance and API, no formulas
- [React Spreadsheet Grid](https://denisraslov.github.io/grid/) - Virtualized, lacks significant UI parts, no formulas
- [Handsonetable](https://handsontable.com/) - Virtualized, lacks dynamic customization. React Spreadsheet uses it's formulas parsing module
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fiddan%2Freact-spreadsheet?ref=badge_large)