Skip to content

grist-widget-sdkReact SDK for Grist custom widgets

A tiny, typed, batteries-included surface that turns the Grist plugin API into idiomatic React.

Compare with the raw plugin API Β· Testing without Grist

What it looks like ​

The hello-world demo is the whole idea in a handful of lines. The playground shell handles Grist setup; you only write:

tsx
import { useGrist, type UseGristOptions } from "grist-widget-sdk"

export const GRIST_OPTIONS: UseGristOptions = {
  requiredAccess: "read table",
}

export function WidgetApp() {
  const w = useGrist()
  const rowKey =
    w.record && typeof w.record.id === "number" ? String(w.record.id) : w.mode

  if (w.mode === "empty") return <p>Select a row.</p>
  if (w.mode === "new-row") return <p>New row flow</p>
  return <p key={rowKey}>Selected row #{String(w.record!.id)}</p>
}

Try it live Β· Source on GitHub

Start with Vite ​

bash
npx degit ArthurBlanchon/grist-widget-sdk/templates/grist-widget-template-vite my-widget
cd my-widget
pnpm install
pnpm dev

See Getting started for templates, typing, and local testing.

Released under the ISC License.