SpreadsheetGrid

Notes for Solid

Differences from the React version (ref, when render functions run, /ai, speed), signals and stores, when writes take effect, actions, async rows, testing, picking the features you ship, versions

Things to keep in mind when using the Solid version (@ishibashi0112/spreadsheet-grid-solid). The props, column definitions, imperative handle methods, callbacks, and CSS classes and tokens are the same as in the React version, so the API reference applies as is. Pick Solid at the top of the sidebar and the guides show their code in Solid. For code without tabs, change the import to @ishibashi0112/spreadsheet-grid-solid and it works as is (call signals when you pass them, as in rows={rows()}, receive the imperative handle with let grid! and ref={grid}, and write gridRef.current?.applyRows(…) as grid.applyRows(…)). For rendering on the server, see SSR.

Differences from the React version

  • ref works like a Solid DOM ref. Use let grid!: SpreadsheetGridHandle<Row> with ref={grid}, or ref={(handle) => (grid = handle)}, to receive a handle with the same methods (there is no React ref object). The handle is set before your component's first createEffect and onSettled, so you can call it there (to restore saved state, scroll to the end, and so on). Inside <Loading>, the grid isn't rendered until the first rows arrive, and methods that change state do nothing until then (you're told once in development). Pass the initial state with initialState, or call the methods from an effect that reads the rows (createEffect(() => rows().length, …)). After the grid is removed (hidden with <Show>, for example), a handle left in a variable does nothing for methods that change state (you're told once in development), and methods that read return the values from when it was removed (you can save grid.getState() in onCleanup; getScrollPosition() returns null and isAtBottom() returns false).
  • Render functions run only when needed. renderCell and renderHeader are called again when the columns change, and the bar functions when the functions change (not on every update as in the React version). Context values (row / value / rowIndex / isActive, the bar context and each item of its derivedSummary, and so on) are looked up when read, so if you read them inside JSX, only that expression follows the change. Calling ctx.setValue on every keystroke in an input inside a cell keeps the input in place without losing focus (since 1.4.0; before that the cell's contents were rebuilt whenever the row changed). If you read them in the function body (including destructuring the argument), the contents are rebuilt when that value changes (for an input in a bar, focus and half-typed text are lost). If you read them at the top of your own component's body (const v = props.ctx.value inside MyCell with renderCell={(ctx) => <MyCell ctx={ctx} />}), later changes are not followed (Solid reports STRICT_READ_UNTRACKED in development). Read them inside JSX there too. Reading a signal from outside the grid in the body of renderCell rebuilds the contents of every visible cell whenever it changes. Read it inside JSX, or go through a memo per row key.
  • Filter with words (/ai, since 1.4.0). Import GridAskBar and createGridAsk (useGridAsk in the React version; Solid's convention is the create… name) from @ishibashi0112/spreadsheet-grid-solid/ai (about 15KB gzip, separate from the grid's bundle). Pass the grid as a function that returns the handle, grid={() => grid} (with let grid! and ref={grid}), or as a signal (ref={setGrid} and grid={grid}) (there are no ref objects). Everything else (your ask, the shape of the answer, gridAskLocaleTextEn from /locales/en) is the same as in the React version (Filter with words).
  • Speed. Scrolling and editing are about as fast as in the React version. Measured on 2026-11-28 in a production build on Chromium: Ctrl+End on a million rows takes about as long as the React version, JS time for large vertical jumps in a table of about 200 columns is shorter than the React version (about 0.6x), small scrolls take about 1.2x, large horizontal jumps about 1.5x, and a table of about 200 columns uses about 3.5MB more memory (each visible cell holds a few Solid computations. When only the rendered range changes, row elements and cell components are reused and only their contents are rewritten).
  • Everything else (props, column definitions, handle methods, callbacks, CSS classes and tokens) is the same as in the API reference.

Things to keep in mind with Solid

  • rows can be a signal or a store. onRowsChange returns a new array on every edit (the same contract as the React version). With a signal, pass it straight back with setRows(next). With createStore, pass it with rows={state.rows} and put it back with setState((s) => { reconcile(next, 'id')(s.rows) }), and undo / redo work just as with a signal (since 1.4.0. setState((s) => { s.rows = next }) also works, but Solid reports IMMUTABLE_UPDATE_IN_STORE in development). Changes made directly inside the store (s.rows[0].name = … / push / splice) also reach the grid, and as when the parent replaces rows in the React version, the undo history is cleared. A store tracks each row to notice changes inside it, so with many rows every edit takes time (about 0.1 seconds per edit at 100,000 rows). Keep tables with more than about 50,000 rows in a signal (you're advised once in development).
  • Writes take effect in a microtask. After setRows(...), the grid sees the new rows the next time changes are applied. To use a row you just added right away (getViewRowIndex(key) → startEditing(...)), call flush() from solid-js first (the same as flushSync in the React docs).
  • Save with an action. You may start an action inside the grid's callbacks (onRowsChange={(next) => save(next)} writing to createOptimistic inside the action, or save(next) after setRows(next)). The grid keeps its own writes out of your action, so the editor closes during the save and further edits go into that row (the same as startTransition in the React version). Take where to save (a project ID and the like) from the rows you received, not from props, which may already have changed to another value. When you refetch the saved rows with refresh(), rows is replaced from outside, so the undo history is cleared (the same as the React version).
  • Async rows. Rows from an async createMemo / createSignal(async) can be used inside <Loading> (the fallback shows until the first rows arrive). During a refetch you can keep working with the previous rows, so show that you're waiting with isPending(() => rows()) (loading={isPending(() => rows())} also turns on the grid's loading display; since 1.15.0. In tables with the replace row find={{ replace: true }}, Solid may report EFFECT_RELAY_TEAR named findReplace in development; it is harmless and doesn't appear in production). With <Loading on={...}>, the fallback replaces the grid during a refetch (the grid's state is kept, and it comes back when the rows arrive). When it is replaced, the value being edited is committed and onRowsChange receives the previous rows. Refetch failures go to your <Errored>. Rows read with createDeferred show the original values during the refetch from a save's refresh() (that is what createDeferred means). With an async createMemo, they keep the saved values.
  • Callbacks after rendering. Callbacks that the React version calls from an effect after rendering (onActiveCellChange / onStateChange / onFiltersChange / onSortChange / onExpandedDetailRowKeysChange, and onRowSelectionChange when deleted rows are removed from the selection) are called right after the change has been applied (in the next microtask), and never after the grid has been removed. In tests, wait once with await Promise.resolve() after flush() before you check.
  • Testing (Vitest + jsdom). Add @solidjs/vite-plugin to your Vitest config. Without the plugin, write browser in all three of resolve.conditions / ssr.resolve.conditions / ssr.resolve.externalConditions. Use the version of @solidjs/testing-library for Solid 2 (the 1.0 release candidate), and since jsdom has no layout, call installJsdomLayoutStubs from @ishibashi0112/spreadsheet-grid-solid/testing. After changing a signal or dispatching an event, call flush() before looking at the DOM (instead of the React version's act() in Testing; for callbacks after rendering, also wait once with await Promise.resolve()).
  • Keeping state in the URL. Pass saved state to initialState on the first render, save it in onStateChange, and apply later changes (back / forward) with grid.applyState(...) (Saving and restoring state). You may read signals inside the grid's callbacks (they are called outside tracking, like event handlers).
  • Expandable rows. detailRow.render is called when a row is opened, and ctx.row looks up the current row when read. Read ctx.row inside JSX (passing it to a component, as in order={ctx.row}, is the same) and only that expression follows edits and undo. Read it in the body of render (including destructuring the argument, ({ row }) => …) and render is called again to rebuild the card every time that row changes (focus and half-typed text in inputs inside the card, and the state of a nested grid, are lost). An input value held with createSignal(() => ctx.row.x) resets whenever the row changes, so hold unsaved input in a plain signal (createSignal(untrack(() => ctx.row.x))). The same goes for custom editors: ctx.value / ctx.row are looked up when read, so read them inside JSX, or take the starting value with untrack(() => ctx.value) (or ctx.initialText) (reading them in the component body makes Solid report STRICT_READ_UNTRACKED in development).
  • Values from outside the row. Make getValue / valueFormatter depend only on the row and the value. If they read an outside signal, cells follow it but totals (aggFunc) don't. When that signal changes, rebuild the columns (const columns = createMemo(() => makeColumns(totals())) and the like).
  • Sharing props between several grids. Spread an object that doesn't change, or list the props one by one. Spreading an object that is rebuilt on every change works, but Solid reports HUGE_FAN_OUT in development.
  • Shadow DOM (Web Components). Put style.css inside the shadow root (<style> or adoptedStyleSheets), wrap the grid in an element instead of rendering it directly under the shadow root (popups appear inside that element), use an open shadow root, and call the dispose returned by render() in disconnectedCallback. Details are in the API reference's "Grids inside Shadow DOM".
  • Solid's notices in development. Under vite dev, Solid may report EFFECT_WRITES_OWN_SOURCE with these effect names: autoHeightMeasurer (after measuring rows in autoHeight columns) / activeRowFollow (when the order changes with activeCellFollows: 'row') / edit (when the order changes while editing) / newRow (when the row count changes while you're in the entry row; since 1.10.0) / history (after undo / redo) / rowSelectionCommands (when deleted rows are removed from the row selection after deleting rows) / pagination (when pagination pulls the current page into range because the row count or the table's height changed; since 1.15.0). These come from the grid realigning its state after a change (the React version does the same re-render). They are harmless and don't appear in production builds. Since 1.4.0, other realignments (keeping the selection inside the range, column widths, scrolling, the server-side row model, callbacks such as onActiveCellChange) don't report EFFECT_RELAY_TEAR (the values written depend on state outside Solid's graph, such as the grid's store and the DOM, so Solid's measuring treats them as "the work of measuring" rather than derived state).

Picking the features you ship

SpreadsheetGrid includes every feature (about 257KB gzip of JS loaded up front; the column filter popover, the tool panel and the calendar, about 18KB, load later). createSpreadsheetGrid builds a grid with only the features you pass, and the rest stay out of your bundle (about 128KB with no features, about 157KB with the standardFeatures preset). Unlike the React version, the feature parts are imported from the same entry point (there is no /lite). Feature names and what they contain are as in reduce the bundle size (the part names are the same too).

import { createSpreadsheetGrid, standardFeatures, serverSideFeature } from '@ishibashi0112/spreadsheet-grid-solid'

// create it once at the top of a module, not inside a component
const Grid = createSpreadsheetGrid({ features: { ...standardFeatures, serverSide: serverSideFeature } })

Versions and changelog

Since 1.4.0 the Solid version is released with the same version number as the React version and the core (1.4.0 came right after 0.1.2), and it depends on the core of the same version. When upgrading from 0.1.x, the range ^0.1.2 doesn't include 1.4.0, so change the range in package.json to ^1.4.0 and check the "behavior changes" of 1.4.0 in the Solid changelog. Versions are raised the same way as the React version: since 1.4.0, breaking changes ship only in major versions (before that, in 0.1.x, they also shipped in minor versions. See Versions and compatibility). Changes shared with the React version are in the CHANGELOG, changes only in the Solid version are in the Solid changelog (both in Japanese), and GitHub Releases show both. Use TypeScript 5.8 or later (moduleResolution set to bundler / nodenext, jsx: "preserve" and jsxImportSource: "@solidjs/web"). If you build a library on top of the Solid version and export inferred types, put the Solid version and the core (the version the Solid version depends on) in peerDependencies.

The README is on npm at @ishibashi0112/spreadsheet-grid-solid (in English and Japanese). The package also includes the API reference (API_REFERENCE.md, the same document as the React version, with a Solid translation guide at the top) and a Skill for AI coding tools (skills/spreadsheet-grid-solid/SKILL.md) (since 0.1.2; see Use with AI assistants).

On this page