react-datasheet-grid

An Airtable-like / Excel-like component to create beautiful spreadsheets.

README

react-datasheet-grid


An Airtable-like / Excel-like component to create beautiful spreadsheets.

Feature rich:
- Dead simple to set up and to use
- Supports copy / pasting to and from Excel, Google-sheet...
- Keyboard navigation and shortcuts fully-supported
- Supports right-clicking and custom context menu
- Supports dragging corner to expand selection
- Easy to extend and implement custom widgets
- Blazing fast, optimized for speed, minimal renders count
- Smooth animations
- Virtualized rows and columns, supports hundreds of thousands of rows
- Extensively customizable, controllable behaviors
- Built with Typescript

Install


  1. ```bash
  2. npm i react-datasheet-grid
  3. ```

Usage


  1. ```tsx
  2. import {
  3.   DataSheetGrid,
  4.   checkboxColumn,
  5.   textColumn,
  6.   keyColumn,
  7. } from 'react-datasheet-grid'

  8. // Import the style only once in your app!
  9. import 'react-datasheet-grid/dist/style.css'

  10. const Example = () => {
  11.   const [ data, setData ] = useState([
  12.     { active: true, firstName: 'Elon', lastName: 'Musk' },
  13.     { active: false, firstName: 'Jeff', lastName: 'Bezos' },
  14.   ])

  15.   const columns = [
  16.     {
  17.       ...keyColumn('active', checkboxColumn),
  18.       title: 'Active',
  19.     },
  20.     {
  21.       ...keyColumn('firstName', textColumn),
  22.       title: 'First name',
  23.     },
  24.     {
  25.       ...keyColumn('lastName', textColumn),
  26.       title: 'Last name',
  27.     },
  28.   ]

  29.   return (
  30.     <DataSheetGrid
  31.       value={data}
  32.       onChange={setData}
  33.       columns={columns}
  34.     />
  35.   )
  36. }
  37. ```