@sheetwrite/react initializes WASM after client mount. Use Sheetwrite for the simple columns and defaultRows contract; use SheetwriteGrid when the host supplies a Workbook plus eager data or a datasource.
onGridChange reports committed grid changes. onReady receives { grid, generation, reason } after the forwarded ref is assigned. Replacing reset-sensitive inputs creates a new generation; destroy persistence/sync coordinators attached to the previous grid.
import "@sheetwrite/react/styles.css" ;
type Row = { name : string ; amount : number };
Server rendering the component does not initialize WASM. Mount it in a client component in frameworks that render on the server.
const Sheetwrite: <Row extends Record<string, CellScalar>, Id extends RowBridgeId = RowBridgeId>(props: SheetwriteProps<Row, Id> & {
ref?: ForwardedRef<Grid>;
}) => ReactElement const Sheetwrite : <
Row extends Record < string , CellScalar >,
Id extends RowBridgeId = RowBridgeId ,
>(
props : SheetwriteProps < Row , Id > & {
ref ?: ForwardedRef < Grid >;
},
) => ReactElement const Sheetwrite : <
Row extends Record <
string ,
CellScalar
>,
Id extends RowBridgeId =
RowBridgeId ,
>(
props : SheetwriteProps <
Row ,
Id
> & {
ref ?: ForwardedRef < Grid >;
},
) => ReactElement Convenience component for local object rows. It derives a single-sheet workbook from columns, defaultRows, and sheetName, initializes Sheetwrite, and owns the Grid through prop-driven resets and unmount cleanup. Pass a ref to access the live Grid; use SheetwriteGrid when the host already owns a workbook or datasource. @example import { Sheetwrite } from "@sheetwrite/react"; export function Sales() { return <Sheetwrite columns={[{ key: "amount", title: "Amount", type: "number" }]} defaultRows={[{ amount: 12 }, { amount: 18 }]} height={400} />; }@see SheetwriteGrid *@see /docs/frameworks/react/API reference → interface GridReadyEvent interface GridReadyEvent interface GridReadyEvent Grid handle, generation, and reason published after adapter initialization. API reference → interface SimpleColumn<Row extends Record<string, CellScalar>> interface SimpleColumn < Row extends Record < string , CellScalar >> interface SimpleColumn < Row extends Record < string , CellScalar >> Column definition accepted by the adapters’ simple row-object API. API reference → interface Transaction interface Transaction interface Transaction Low-level Store transaction. epoch provides optional optimistic concurrency at the storage boundary. Calling Store.applyTransaction bypasses Grid read-only checks and Grid undo/redo history. Host-driven edits should use Grid.applyTransaction. @example import type { Store, SheetId, Transaction } from "@sheetwrite/core"; function setAmount(store: Store, sheet: SheetId) { const transaction: Transaction = { patches: [{ op: "set", addr: { sheet, row: 0, col: 0 }, value: { kind: "literal", value: 25 } }], }; return store.applyTransaction(transaction); }@see Grid.applyTransactionAPI reference → type Row = {
name: string;
amount: number;
} type Row = {
name : string ;
amount : number ;
}; type Row = {
name : string ;
amount : number ;
}; name: string let name : string let name : string User-facing sheet name shown in tabs and workbook exports. API reference → SheetProps.columns: readonly SimpleColumn<Row>[] interface SheetProps {
columns : readonly SimpleColumn < Row >[];
} interface SheetProps {
columns : readonly SimpleColumn < Row >[];
} Exact column runs represented by every returned row. API reference → SheetProps.rows: readonly Row[] interface SheetProps {
rows : readonly Row [];
} interface SheetProps {
rows : readonly Row [];
} end-exclusive row range API reference → SheetProps.save: (transaction: Transaction) => void interface SheetProps {
save : ( transaction : Transaction ) => void ;
} interface SheetProps {
save : (
transaction : Transaction ,
) => void ;
} API reference → transaction: Transaction let transaction : Transaction let transaction : Transaction Operations that actually committed after policy and bounds filtering. API reference → SheetProps.onReady: (event: GridReadyEvent) => void interface SheetProps {
onReady : ( event : GridReadyEvent ) => void ;
} interface SheetProps {
onReady : (
event : GridReadyEvent ,
) => void ;
} Fires after the adapter publishes a ready Grid generation. API reference → function Sheet({ columns, rows, save, onReady }: SheetProps): JSX.Element function Sheet ({
columns ,
rows ,
save ,
onReady ,
} : SheetProps ) : JSX . Element function Sheet ({
columns ,
rows ,
save ,
onReady ,
} : SheetProps ) : JSX . Element API reference → columns: readonly SimpleColumn<Row>[] let columns : readonly SimpleColumn < Row >[] let columns : readonly SimpleColumn < Row >[] Exact column runs represented by every returned row. API reference → rows: readonly Row[] let rows : readonly Row [] let rows : readonly Row [] end-exclusive row range API reference → save: (transaction: Transaction) => void let save : ( transaction : Transaction ) => void let save : (
transaction : Transaction ,
) => void API reference → onReady: (event: GridReadyEvent) => void let onReady : ( event : GridReadyEvent ) => void let onReady : (
event : GridReadyEvent ,
) => void Fires after the adapter publishes a ready Grid generation. API reference → interface SheetProps interface SheetProps interface SheetProps columns: readonly SimpleColumn<Row>[] let columns : readonly SimpleColumn < Row >[] let columns : readonly SimpleColumn < Row >[] Ordered schema used to derive the component-owned sheet. API reference → defaultRows: readonly Row[] let defaultRows : readonly Row [] let defaultRows : readonly Row [] Rows converted to initial columnar data; missing column keys become null. API reference → height: string | number let height : string | number let height :
string | number Host height in CSS pixels for numbers or any CSS length string. API reference → onGridChange?: ((event: ChangeEvent) => void) | undefined onGridChange ?: (( event : ChangeEvent ) => void ) | undefined onGridChange ?: (( event : ChangeEvent ) => void ) | undefined Receives every committed Grid change, including its applied transaction. API reference → event: ChangeEvent let event : ChangeEvent let event : ChangeEvent API reference → ChangeEvent.transaction: Transaction interface ChangeEvent {
transaction : Transaction ;
} interface ChangeEvent {
transaction : Transaction ;
} Operations that actually committed after policy and bounds filtering. API reference → onReady?: ((event: GridReadyEvent) => void) | undefined onReady ?: (( event : GridReadyEvent ) => void ) | undefined onReady ?: (( event : GridReadyEvent ) => void ) | undefined Fires after the adapter publishes a ready Grid generation. API reference →