Skip to Content
Grist Widgets

API reference

Every name grist-widget-sdk exports, by entry point.

The complete public surface. Anything not listed here is internal. The list is pinned by packages/core/tests/sdk/public-api.test.ts: a name can't be added or removed without changing it.

Entry points

Import pathUse for
grist-widget-sdkThe hooks, the provider and boundary, cell and attachment helpers, types.
grist-widget-sdk/actionsUser actions for applyActions(): schema changes and batches.
grist-widget-sdk/appmountGristWidget(): what src/main.tsx wires (inside- and outside-Grist pages, theme), plus useTheme() and the deploy channel helpers.
grist-widget-sdk/emulatorThe emulator, the engine of the testing helpers.
grist-widget-sdk/emulator/testingrenderWithGrist, smokeTestWidget, presets and Testing Library.
grist-widget-sdk/tsconfig/app.json, grist-widget-sdk/tsconfig/node.jsonTypeScript settings for a widget's tsconfig.app.json and tsconfig.node.json to extends (TypeScript 5.8 or later). A stricter check only ships in a minor release.

By entry point

Each table is generated from the SDK's own documentation comments, the ones your editor shows on hover, so it lists every public name and nothing else. The pages linked from each section explain them.

grist-widget-sdk

The hooks (useGrist, useGristSchema), the provider and boundary, the cell and attachment helpers, and the types. defineGristWidget() is explained in Typed reads.

NameKindWhat it is
checkGristCellfunctionChecks one value against a Grist column type ("Numeric", "Ref:People", "Text,Ref"), as typed reads do: the value the type promises, or why it doesn't fit.
checkGristCell(type: string | undefined, value: unknown, options?: { encoded?: boolean; }): GristCellCheck
decodeGristValuefunctionDecodes a Grist cell value into an idiomatic JS value.
decodeGristValue(value: unknown, column?: GristReplicaColumn): GristDecodedValue
defineGristWidgetfunctionDeclares a widget. The const type parameter keeps the column names and types literal, so the mapped record is typed with no annotation, no as const and no generics.
defineGristWidget<const D extends GristWidgetDefinition>(definition: D): GristWidget<D>
encodeGristCellfunctionA value as Grist stores it in a column of the declared type: the reverse of what typed reads give. Lists become ["L", ...] (a RefList's Reference items become their row ids), a Date for a Date or DateTime column becomes seconds since the epoch, a Reference for a Ref column its row id. A RefList or Attachments list already encoded (["L", ...], as the attachment helpers return it) and every other value pass through, so it is safe to call twice on those. A ChoiceList value is always a list of choices: a first choice "L" is kept, so give it as the choices (["L", "M"] writes the sizes L and M), never encoded.
encodeGristCell(type: string | undefined, value: unknown): unknown
encodeGristValuefunctionEncodes a JS value into Grist's expected wire form for a given column type.
encodeGristValue(value: unknown, column?: GristReplicaColumn): unknown
extractGristAttachmentIdfunctionFirst attachment id in the cell, if any (see extractGristAttachmentIdsFromCell).
extractGristAttachmentId(value: unknown): string | undefined
extractGristAttachmentIdsFromCellfunctionAll attachment ids found in a Grist attachment cell value (ordered, deduped). Attachment columns are usually an **array** of file refs; a single id or one JSON object is also supported.
extractGristAttachmentIdsFromCell(value: unknown): string[]
FetchRowstypeA table's rows, each { id, ...cells } under real column ids. Without a table id, the widget's own table as its section shows it (filters and sort applied); with one, any table (full access), in Grist's row order. { columnar: true } gives Grist's columns instead.
FetchRowsOptionstypefetchRows() options: rows (the default) or Grist's columns.
GristApitypeThe methods useGrist() returns next to its state: reads, writes, attachments and the cursor.
GristApplyUserActionsOptionstypeOptional second argument to docApi.applyUserActions.
gristAttachmentCellValuefunctionWire value for a single-file Attachments cell.
gristAttachmentCellValue(attachmentId: string | number): GristEncodedAttachmentList
gristAttachmentCellValuesfunctionWire value for an Attachments cell (Grist list encoding).
gristAttachmentCellValues(attachmentIds: (string | number)[]): GristEncodedAttachmentList
GristAttachmentUploadResulttypeThe attachment ids an upload created.
GristBoundaryfunctionRenders the widget once Grist is connected, has granted the access it declares, and every required declared column is mapped; until then, a screen that says what is missing (with a retry where one can help). Requires <GristWidgetProvider>; mountGristWidget() renders both.
GristBoundary(input: GristBoundaryProps): react.JSX.Element
GristBoundaryPropstypeThe widget, shown once it is connected, has its access and its required columns mapped.
GristCellChecktypeWhat checkGristCell returns: the cell's value, or why it doesn't match its declared type.
GristCellIssuetypeA mapped cell that didn't match its declared type, or a rule of the widget's schema.
GristChoiceListEntrytypeOne selectable choice for UI (value stored in the cell is value).
GristColumnarTabletypeColumn-oriented table payload, as Grist's grist.docApi.fetchTable and grist.fetchSelectedTable send it: { id: [...], Name: [...] }.
GristColumnExcludeContexttypeWhat extraExcludeColumn is given for each column.
GristColumnInfotypeOne column of a table, as listColumns() gives it.
GristColumnsToMaptypeArgument shape for grist.ready({ columns }).
GristColumnToMaptypeSingle-column declaration in grist.ready({ columns }). Mirrors Grist ColumnToMap. See https://support.getgrist.com/code/interfaces/grist_plugin_api.ColumnToMap/
GristCursorPostypeArgument to grist.setCursorPos (subset of Grist CursorPos).
GristDecodedValuetypeA cell as decodeGristValue returns it: plain values, Dates and lists, or an error or a reference marker.
GristDocumentModetypeHow row bodies were populated when the replica document was built (hint only). Loaders should still treat omitted rows like [] via normalizeReplicaTableInput.
GristEncodedAttachmentListtypeAn Attachments cell as Grist writes it: ["L", ...ids].
GristEncodedErrortype["E", "ErrorClass", "message", traceback?] — Grist error sentinel.
GristFetchedAttachmentBlobtypeAn attachment's bytes, and their content type.
GristFetchSelectedOptionstypeOptions for Grist's own grist.fetchSelectedTable / grist.fetchSelectedRecord (GristView).
GristFormulaKindtypeHow Grist treats the column (from _grist_Tables_column isFormula + formula). empty_slot is Grist's "empty column" state: isFormula true with no formula text.
GristMappedRowtypeThe mapped record a declaration's columns give: { id } and each declared column, typed from its Grist type. widget.useGrist() uses it, and GristWidgetRow<typeof widget> names it for a component's props.
GristMinimalRecordtypeThe least a record has: its row id.
GristNoiseColumnsOptionstypeWhich of Grist's bookkeeping columns to leave out: the row id, helper columns, logging columns, manualSort.
GristReadyOptionstypeArguments accepted by grist.ready for custom widgets.
GristRecordPatchtypeA write under declared names: any of the mapped record's fields but its id.
GristReplicaColumntypeColumn metadata in replica JSON: Grist-native fields only (no samples / scan stats). formulaKind is optional UI convenience; use resolveGristFormulaKind when missing.
GristReplicaDocumenttypeCanonical Grist replica document: one JSON type for getDocumentJson, fixtures, and createGristEmulator({ document }).
GristReplicaRowtypeDecoded row in replica JSON (id + fields). Same as wire fetchTable row objects, but **not** columnar Record<colId, unknown[]> — that shape is only on docApi.fetchTable.
GristReplicaSelectiontypeSelection slice persisted on replica fixtures (emulator / widget).
GristReplicaTabletypeOne table of a replica document: its columns and, optionally, its rows.
GristRequiredAccesstypeAccess level passed to grist.ready({ requiredAccess }).
GristRowRecordtypeA row from grist.onRecord or fetchTable. Always carries a numeric id.
GristSchemaTableViewtypeSelected table slice with tableId for consumers that expect it on the object.
GristSdkAlertKindtypeThe alerts mountGristWidget() shows above a running widget: what needs the user's attention in Grist (column mapping, access, a failed write, an unlinked section). The blocking states (not connected, access refused, required columns unmapped) are <GristBoundary>'s, not alerts.
GristTableNewRecordtypeRecord for create (no id needed).
GristTableOperationstypeWraps grist.getTable(...) / grist.selectedTable.
GristTableOpOptionstypeOptions accepted by TableOperations.create / update.
GristTableUpdateRecordtypeTableOperations-style record for update. Must include id; other fields are partial.
GristTableUpsertOptionstypeOptions accepted by TableOperations.upsert.
GristTableUpsertRecordtypeRecord for upsert: require is the match key set, fields is what to write.
GristThemetypeThe widget's connection to Grist: one store, one connect().
GristUserActionTupletypeGrist docApi.applyUserActions payloads are arrays of user-action tuples.
GristWidgettypeA declared widget. Pass it to mountGristWidget() (as widget, exported from src/app/App.tsx).
GristWidgetActionStatustypeA write's status: none running, one running, or the last one failed (actionError says why).
GristWidgetColumnMaptypeMapping returned by Grist between logical widget column names and real table column ids. Single mappings are string; allowMultiple columns are string[].
GristWidgetConfigurationtypeLast grist.ready options mirrored with the emulator (optional on fixtures).
GristWidgetDefinitiontypeWhat a widget declares: UseGristOptions, plus its title, description and where to report a problem.
GristWidgetDemotypeA widget's demo data (src/app/demo.ts, exported as demo): the document its demo page, its real-Grist check and create-grist-widget demo open, in place of generated sample rows. The demo page is public: invented data only, and never a key in its options.
GristWidgetDemoColumnTypetypeThe column types demo data takes.
GristWidgetInteractiontypeSecond argument to grist.onOptions — document ↔ widget relationship (subset of Grist InteractionOptions).
GristWidgetLinkingInfotypeLinking state reported by Grist in onOptions settings (InteractionOptions.linking).
GristWidgetMetadatatypeWhat describes a widget rather than configures it: its title, description, report URL and languages.
GristWidgetModetypeDerived from the selection: no row, a row, or the add-row placeholder.
GristWidgetProviderfunctionConnects to Grist for the widgets below it: useGrist() under it reads this connection. mountGristWidget() renders it; render it yourself only for a page that manages its own React root.
GristWidgetProvider(input: GristWidgetProviderProps): react.JSX.Element
GristWidgetProviderPropstypeWhat the provider connects with, and the widgets below it.
GristWidgetRowtypeThe widget's mapped record type, from its declaration.
GristWidgetStatustypeThe widget's connection to Grist, as useGrist().status reports it.
httpUrlfunctionvalue as a URL a widget may link to or load from: an absolute http: or https: URL, normalised, or undefined. Use it on every link or source that comes from a document's data, before it reaches an href or a src.
httpUrl(value: unknown): string | undefined
isGristCellErrorfunctionConvenience: true when the cell is a Grist error sentinel.
isGristCellError(value: unknown): value is GristEncodedError
ListColumnsOptionstypelistColumns()'s options: which columns to leave out.
ListTablesOptionstypeuseGrist()'s methods, created once per runtime: every one is referentially stable for the widget's lifetime, and reads grist when called (the emulator installs and removes it in tests).
mergeGristAttachmentCellValuefunctionMerge new attachment ids into an existing Attachments cell value (deduped, order preserved).
mergeGristAttachmentCellValue(existingCell: unknown, newIds: (string | number)[]): GristEncodedAttachmentList
MigrateWidgetOptionstypeBrings options written under fromVersion (lower than the widget's optionsVersion) to the current version. Return a new plain object; options it can't migrate: throw, and they are left as they are. Check the options' shape rather than trust fromVersion alone: options without a version count as version 1, and may already be in a later shape.
normalizeGristChoiceListEntriesfunctionNormalizes Grist Choice / ChoiceList widgetOptions into a flat list for dropdowns. choices entries are string labels (the stored cell value). Per-choice styling lives in choiceOptions[label].
normalizeGristChoiceListEntries(widgetOptions: Record<string, unknown> | undefined): GristChoiceListEntry[]
ReplicaDocumentJsonOptionstypeOptions for getDocumentJson / buildDocumentJson on the return value of useGristSchema.
resolveGristFormulaKindfunctionUse when formulaKind may be missing (e.g. older document builds).
resolveGristFormulaKind(col: GristReplicaColumn): GristFormulaKind
StandardSchematypeMinimal Standard Schema (https://standardschema.dev): zod 4, valibot, arktype implement it.
tableDataToRowsfunctionTurn fetchTable output into row objects (order follows the id column).
tableDataToRows<T = Record<string, unknown>>(data: GristColumnarTable): GristRowRecord<T>[]
useGristfunctionThe widget's Grist state and API, from the nearest <GristWidgetProvider>: mountGristWidget() renders one inside Grist, and renderWithGrist(<App />, { widget }) in a test. Throws outside one; a component that also runs outside Grist calls useGristOptional().
useGrist<TRow = Record<string, unknown>, TMapped = Record<string, unknown>>(): UseGristResult<TRow, TMapped>
useGristOptionalfunctionuseGrist() inside a provider, or null outside one: for components that also work without Grist.
useGristOptional<TRow = Record<string, unknown>, TMapped = Record<string, unknown>>(): UseGristResult<TRow, TMapped> | null
UseGristOptionstypeWhat the widget asks Grist for: access, columns to map, and the alerts it doesn't want.
UseGristResulttypeThe widget's Grist state and API. Every method is referentially stable for the widget's lifetime: safe in effect dependencies. The object itself is new whenever a value changes; depend on the members you use, not on it.
useGristSchemafunctionGrist replica-document hook: metadata + optional decoded rows per table.
useGristSchema(options?: UseGristSchemaOptions): UseGristSchemaResult
UseGristSchemaOptionstypeWhat useGristSchema reads. The connection (access level, columns) is the widget's declaration, from defineGristWidget(): the hook reads it through the provider mountGristWidget() renders.
UseGristSchemaResulttypeWhat useGristSchema() returns: the document as a replica, and its JSON.
useWidgetMetadatafunctionDeprecated: mountGristWidget() sets the page's title and meta tags from the declaration. Sets the page's title and its description meta tags.
useWidgetMetadata(input?: UseWidgetMetadataInput | null): void
UseWidgetMetadataInputtypeThe page's title and description.
ValidateColumnMappingsResulttypeWhether the declared columns are mapped: what is missing, and whether Grist has sent the mappings yet.

grist-widget-sdk/app

Mounting a widget: mountGristWidget(), the theme and the deploy channels.

NameKindWhat it is
DeployChanneltypeWhere a deployed build is being served from.
deployChannelLabelfunction"latest", "dev", "v1" (a major's channel) or "v1.2.0".
deployChannelLabel(channel: DeployChannel): string
DeployPathtypeA served URL's channel, and the base path its channels share: what parseDeployPath returns.
GristWidgetAppfunctionThe tree mountGristWidget renders, as a component: for a test, or for a page that manages its own React root.
GristWidgetApp(input: GristWidgetAppProps): react.JSX.Element
GristWidgetAppPropstypeWhat renders a widget: the component, what it asks Grist for, and the pages and alerts around it.
GristWidgetEntrytypeA widget's entry module, src/app/App.tsx, as import * as entry gives it: the widget as its default export, its declaration as widget, and optionally its Settings, and its own Alerts, LocalDevPage and ReleasePage.
MountedGristWidgettypeA mounted widget: unmount() removes it and its React root.
mountGristWidgetfunctionRender a widget into the page: everything src/main.tsx used to wire by hand.
mountGristWidget(entry: GristWidgetEntry, options?: { dev?: boolean; root?: Element | string; }): MountedGristWidget
mountGristWidget(config: MountGristWidgetConfig): MountedGristWidget
MountGristWidgetConfigtypemountGristWidget()'s older form: the widget's props, and where to render.
parseDeployPathfunctionParse a pathname into its deploy channel and base path. A path without a channel segment (the deployed root, or a local dev server) is latest: the deploy places the latest release at the root too.
parseDeployPath(pathname: string): DeployPath
ReleasedVersiontypeOne entry of the versions.json a widget's deploy pipeline maintains.
ResolvedWidgetThemetypeThe theme applied: "system" resolved to light or dark.
useReleasedVersionsfunctionThe widget's released versions, read from the versions.json next to its channels (see parseDeployPath). For a page shown outside Grist, such as a release page linking to each version.
useReleasedVersions(pathname?: string): UseReleasedVersionsResult
UseReleasedVersionsResulttypeWhat useReleasedVersions() returns.
useThemefunctionThe widget's current theme, for components that need it in JavaScript (a toaster, a chart). Same shape as shadcn's useTheme(). Styles should rely on the dark class that mountGristWidget keeps on <html>. Outside a mounted widget (a unit test, for instance) it reports the system theme and setTheme does nothing.
useTheme(): UseThemeResult
UseThemeResulttypeWhat useTheme() returns.
WidgetThemetypeA theme choice: light, dark, or the system's.

grist-widget-sdk/actions

User actions for applyActions().

NameKindWhat it is
gristAddColumnActionfunction["AddColumn", tableId, colId, colInfo] — colInfo shape depends on Grist version / column type.
gristAddColumnAction(tableId: string, colId: string, colInfo: Record<string, unknown>): GristUserActionTuple
gristAddRecordActionfunction["AddRecord", tableId, null, { col: value, ... }]
gristAddRecordAction(tableId: string, values: Record<string, unknown>): GristUserActionTuple
gristAddTableActionfunction["AddTable", tableId, columns]: a new table and its columns, each { id, type?, isFormula?, formula?, … }, as Grist's AddTable takes them.
gristAddTableAction(tableId: string, columns: ReadonlyArray<{ id: string; } & Record<string, unknown>>): GristUserActionTuple
gristAddVisibleColumnActionfunction["AddVisibleColumn", tableId, colId, colInfo] — like AddColumn but also adds the column to the current view section.
gristAddVisibleColumnAction(tableId: string, colId: string, colInfo: Record<string, unknown>): GristUserActionTuple
gristBulkAddRecordActionfunction["BulkAddRecord", tableId, rowIds | nullArray, { col: value[], ... }]. Pass null (or omit) for rowIds to let Grist allocate ids; in user-action format Grist expects an array of nulls of the same length as the value arrays.
gristBulkAddRecordAction(tableId: string, values: Record<string, unknown[]>, rowIds?: Array<number | null>): GristUserActionTuple
gristBulkRemoveRecordActionfunction["BulkRemoveRecord", tableId, rowIds]
gristBulkRemoveRecordAction(tableId: string, rowIds: number[]): GristUserActionTuple
gristBulkUpdateRecordActionfunction["BulkUpdateRecord", tableId, rowIds, { col: value[], ... }]
gristBulkUpdateRecordAction(tableId: string, rowIds: number[], columnarPatch: Record<string, unknown[]>): GristUserActionTuple
gristModifyColumnActionfunction["ModifyColumn", tableId, colId, colInfo]
gristModifyColumnAction(tableId: string, colId: string, colInfo: Record<string, unknown>): GristUserActionTuple
gristRemoveColumnActionfunction["RemoveColumn", tableId, colId]
gristRemoveColumnAction(tableId: string, colId: string): GristUserActionTuple
gristRemoveRecordActionfunction["RemoveRecord", tableId, rowId]
gristRemoveRecordAction(tableId: string, rowId: number): GristUserActionTuple
gristRenameColumnActionfunction["RenameColumn", tableId, colId, newColId]
gristRenameColumnAction(tableId: string, colId: string, newColId: string): GristUserActionTuple
gristUpdateRecordActionfunction["UpdateRecord", tableId, rowId, { col: value, ... }]
gristUpdateRecordAction(tableId: string, rowId: number, patch: Record<string, unknown>): GristUserActionTuple
GristUserActionTupletypeGrist docApi.applyUserActions payloads are arrays of user-action tuples.

grist-widget-sdk/emulator

The emulator, the engine of the testing helpers.

NameKindWhat it is
CreateDocumentInputtypeReplica document for createDocument; widens table columns to EmulatorColumn.
CreateDocumentTableInputtypeReplica table for createDocument; columns may include formulaFn / inferredFormula (emulator-only).
createGristEmulatorfunctionCreates an emulator for a replica document: it checks the document, installs the grist global (inline transport) and answers the widget as Grist does. Tests usually go through renderWithGrist().
createGristEmulator(options: CreateGristEmulatorOptions): GristEmulator
CreateGristEmulatorOptionstypeTop-level emulator factory. Produces a fully-wired emulator instance:
EmulatorActionErrorclassA user action the emulator could not apply (a missing row, an action it does not support): the action, and why.
EmulatorApiBundletypeBundles the six host-side Grist API implementations into one record so inline transport can wire them up.
EmulatorColumntypeColumn metadata for the emulator: GristReplicaColumn plus in-process formulaFn (never serialized in replica JSON).
EmulatorDocumentStatetypeThe emulator's document: its tables, the widget's selection and options.
EmulatorEventtypeTiny pub-sub used to broadcast every emulator state change to: - the transports (which translate events into protocol messages), - the React DevTools inspector (timeline view), - the testing harness (assertions on emitted events).
EmulatorRowIdtypeCore types for the in-memory Grist emulator document model.
EmulatorTabletypeOne table of the emulator's document: its columns and rows.
EmulatorTransporttypeHow the emulator reaches the widget: pushes Grist's events to it.
GristEmulatortypeAn in-memory Grist document and the grist global a widget reads it through.
GristReplicaDocumenttypeCanonical Grist replica document: one JSON type for getDocumentJson, fixtures, and createGristEmulator({ document }).
InlineGristGlobaltypeShape of the synthesised global. Matches globalThis.grist from grist-global.d.ts.
parseDocumentfunctionChecks a replica document and returns it, or throws naming each problem's path.
parseDocument(input: unknown): GristReplicaDocument
presetsconstUseful templates for quick demos and tests.
safeParseDocumentfunctionChecks a replica document, returning zod's result instead of throwing.
safeParseDocument(input: unknown): z.ZodSafeParseResult<{ generatedAt: string; tables: Record<string, { label?: string | undefined; columns?: Record<string, { colRef?: number | undefined; type?: string | undefined; label?: string | undefined; parentPos?: number | undefined; isFormula?: boolean | undefined; formulaKind?: "computed" | "trigger" | "none" | "empty_slot" | undefined; formula?: string | undefined; description?: string | undefined; widgetOptions?: Record<string, unknown> | undefined; displayColRef?: number | undefined; visibleColRef?: number | undefined; }> | undefined; rows?: { [x: string]: unknown; id: number; }[] | undefined; rowCount?: number | undefined; dataOmitted?: boolean | undefined; dataOmittedReason?: string | undefined; error?: string | undefined; }>; source?: string | undefined; docName?: string | undefined; mode?: "schema-only" | "schema+samples" | "schema+data" | undefined; selection?: { tableId?: string | undefined; rowId?: number | "new" | null | undefined; mappings?: unknown; cursor?: unknown; } | undefined; widgetOptions?: Record<string, unknown> | undefined; widgetInteraction?: unknown; configuration?: { requiredAccess?: string | undefined; columns?: unknown; allowSelectBy?: boolean | undefined; hasCustomOptions?: boolean | undefined; } | undefined; accessToken?: { token: string; baseUrl: string; ttlMsecs: number; } | null | undefined; }>

grist-widget-sdk/emulator/testing

Testing a widget without a Grist document.

NameKindWhat it is
actre-exportRe-exported from @testing-library/react, unchanged.
actionsOffunctionThe user actions applied to the emulator, oldest first: the widget's, and the test's own apply and mutate. Read from the bus's history, which keeps the last 200 events and is cleared by dispose().
actionsOf(emulator: GristEmulator): unknown[][]
cleanupre-exportRe-exported from @testing-library/react, unchanged.
eventsOffunctionThe last 200 events on the emulator's bus, oldest first (cleared by dispose()): ready, cursor, data, options, mappings, theme and user actions.
eventsOf(emulator: GristEmulator): readonly EmulatorEvent[]
fireEventre-exportRe-exported from @testing-library/react, unchanged.
installJsdomStubsfunctionBrowser APIs jsdom lacks but widget UI commonly uses, as inert stand-ins: ResizeObserver (charts, virtualized lists, popovers) and window.matchMedia (the theme, responsive hooks; it reports a light, wide screen). Only installs what's missing, so a test's own mock wins.
installJsdomStubs(): void
presetsconstUseful templates for quick demos and tests.
renderre-exportRe-exported from @testing-library/react, unchanged.
RenderOptionsre-exportRe-exported from @testing-library/react, unchanged.
RenderResultre-exportRe-exported from @testing-library/react, unchanged.
renderWithGristfunctionRenders a component against an in-memory Grist (the emulator), behind the same grist global a widget reads in Grist. With widget, it renders the widget in its provider, boundary and alerts, every declared column mapped to a table of rows: renderWithGrist(<App />, { widget, rows }).
renderWithGrist(ui: ReactElement, options?: RenderWithGristOptions): RenderWithGristResult
RenderWithGristOptionstyperenderWithGrist(ui, options) — drop-in replacement for @testing-library/react's render(ui) that boots a Grist emulator (inline transport) and exposes it to the test.
RenderWithGristResulttypeTesting Library's render result, with the emulator the widget runs against.
screenre-exportRe-exported from @testing-library/react, unchanged.
smokeTestWidgetfunctionMounts the widget the way mountGristWidget() does inside Grist, against an emulated Grist document with every column it declares mapped and the access it requests granted, and waits until it renders past GristBoundary. Resolves once it has, rejects with the widget's own error if it throws, or with what the page showed instead if it never gets there. Then unmounts.
smokeTestWidget(input: SmokeTestWidgetOptions | GristWidgetEntry, extra?: Pick<SmokeTestWidgetOptions, "document" | "timeout">): Promise<void>
SmokeTestWidgetOptionstypeWhat smokeTestWidget() renders, and against which document.
waitForre-exportRe-exported from @testing-library/react, unchanged.
waitForEventfunctionResolves with the next event of a kind on the emulator's bus, or rejects after the timeout, naming the last events seen.
waitForEvent(emulator: GristEmulator, kind: WaitForEventKind, options?: WaitForEventOptions): Promise<EmulatorEvent>
waitForEvent(emulator: GristEmulator, predicate: (event: EmulatorEvent) => boolean, timeoutMs?: number): Promise<EmulatorEvent>
WaitForEventKindtypeBus event kinds aligned with grist host callbacks (see inline transport).
WaitForEventOptionstypewaitForEvent()'s options: how long to wait, in ms (default 1000).
withinre-exportRe-exported from @testing-library/react, unchanged.

How names are retired, and what each version promises: Versioning policy.

On this page