Skip to main content

Getting started

Install react-datasheet-grid using npm or yarn:

npm i react-datasheet-grid

Usage

You can start by using built in columns:

import {
DataSheetGrid,
checkboxColumn,
textColumn,
keyColumn,
} from 'react-datasheet-grid'

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

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

const columns = [
{ ...keyColumn('active', checkboxColumn), title: 'Active',resizable:true },
{ ...keyColumn('firstName', textColumn), title: 'First name',,resizable:true },
{ ...keyColumn('lastName', textColumn), title: 'Last name',,resizable:true },
]

return (
<DataSheetGrid
value={data}
onChange={setData}
columns={columns}
/>
)
}

Demo

Active
1
2
rows