SpreadsheetGrid

Quick start

Run a minimal grid with the Solid version

A minimal example

Call the signal when you pass it, as in rows={rows()}, and take edits from onRowsChange back into the signal. Each column needs at least a key and a width.

import { createSignal } from 'solid-js'
import { SpreadsheetGrid, type GridColumn } from '@ishibashi0112/spreadsheet-grid-solid'
import { localeTextEn } from '@ishibashi0112/spreadsheet-grid-solid/locales/en'
import '@ishibashi0112/spreadsheet-grid-solid/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] = createSignal<Row[]>([
    { id: 1, name: 'Apple',  qty: 3 },
    { id: 2, name: 'Banana', qty: 5 },
  ])

  return (
    <SpreadsheetGrid
      rows={rows()}
      columns={columns}
      onRowsChange={(next) => setRows(next)}
      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-solid/locales/en to localeText to show it in English (English and text). Column definitions (columns) are the same in the React and Solid versions. Rows can also live in a store (Notes for Solid).

See it in action

This demo runs the Solid version (@ishibashi0112/spreadsheet-grid-solid) on Solid 2.0.

  • 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)

You can open the editable inventory table (Solid) in StackBlitz. It is the same table as the React inventory table sample (10,000 rows; pinned columns / editors / validation / sorting and filtering / conditional formatting / total row / fill handle / find in cells / CSV) written with the Solid version, as a standalone Vite 8 + Solid 2 + TypeScript project (the source is examples/solid on GitHub; its text is in Japanese).

Next steps

  • Notes for Solid: differences from the React version, how to receive the ref, signals and stores, when writes take effect, testing, picking the features you ship
  • SSR: rendering on the server
  • Guides: how to use each feature (code samples follow the framework you picked at the top of the sidebar)

On this page