SpreadsheetGrid

Quick start

Run a minimal grid with the React version

A minimal example

Pass rows and onRowsChange, and the grid works as a controlled component. Each column needs at least a key and a width.

import { useState } from 'react'
import { SpreadsheetGrid, type GridColumn } from '@ishibashi0112/spreadsheet-grid'
import { localeTextEn } from '@ishibashi0112/spreadsheet-grid/locales/en'
import '@ishibashi0112/spreadsheet-grid/style.css'

type Row = { id: number; name: string; qty: number }

const columns: GridColumn<Row>[] = [
  { key: 'name', title: 'Name', width: 200, editable: true, filterType: 'text' },
  { key: 'qty',  title: 'Qty',  width: 120, editable: true, filterType: 'number' },
]

export function Example() {
  const [rows, setRows] = useState<Row[]>([
    { id: 1, name: 'Apple',  qty: 3 },
    { id: 2, name: 'Banana', qty: 5 },
  ])

  return (
    <SpreadsheetGrid
      rows={rows}
      columns={columns}
      onRowsChange={setRows}
      rowKeyGetter={(row) => row.id}
      localeText={localeTextEn}
    />
  )
}

The text the grid shows itself (the bottom bar, menus, filter screens, messages) is Japanese by default. Pass localeTextEn from @ishibashi0112/spreadsheet-grid/locales/en to localeText to show it in English (English and text). Column definitions (columns) are the same in the React and Solid versions.

See it in action

Rows 4 of 4Columns 3 of 3Sort: —
#
1
2
3
4
Rows 4 of 4Columns 3 of 3
Cell —Range —0 cells / 0 rows0 columns
  • Double-click a cell (or press F2, or just start typing) to edit it
  • Drag, or use Shift + arrow keys, to select a range, and Ctrl/Cmd+C / Ctrl/Cmd+V to copy and paste
  • Sort and filter from the column header menu
  • Ctrl/Cmd+Z to undo, Ctrl/Cmd+Shift+Z to redo

Try it in the browser (StackBlitz)

These samples open in StackBlitz, so you can run and edit them without installing anything. Each is a standalone Vite + React + TypeScript project that uses the version published on npm (sources are in examples/ on GitHub). The samples' text is in Japanese.

SampleWhat it shows
Editable inventory table10,000 rows. Pinned columns / editors (number, select, date) / validation / sorting and filtering / conditional formatting / total row / fill handle / find in cells / CSV
Server-side row model100,000 records fetched as you scroll. Sorting, filtering and search run on a (simulated) server, and edits are saved (rolled back if saving fails)
A grid inside Astryxthemes/astryx.css matches the colors to the Astryx theme, and cells render Astryx components

Next steps

  • Notes for React: ref on React 18 / 19, using a new row right away, testing, picking the features you ship
  • Next.js and SSR: the 'use client' boundary in the App Router, and what the server renders
  • Guides: how to use each feature (code samples follow the framework you picked at the top of the sidebar)

On this page