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.
Package @sheetwrite/react
Source packages/react/src/index.tsx#L278
Declaration
function Sheetwrite < Row extends Record < string , CellScalar type CellScalar = string | number | boolean | null; type CellScalar = string | number | boolean | null ; type CellScalar =
| string
| number
| boolean
| null ; A scalar that can be displayed directly. API reference → >>( props : SheetwriteProps type SheetwriteProps<Row extends Record<string, CellScalar>> = Omit<
SheetwriteGridProps,
"workbook" | "data" | "datasource" | "height" | "fill"
> &
GridSizeProps & {
columns: readonly SimpleColumn<Row>[];
defaultRows: readonly Row[];
sheetName?: string;
}; type SheetwriteProps < Row extends Record < string , CellScalar >> = Omit <
SheetwriteGridProps ,
"workbook" | "data" | "datasource" | "height" | "fill"
> &
GridSizeProps & {
columns : readonly SimpleColumn < Row >[];
defaultRows : readonly Row [];
sheetName ?: string ;
}; type SheetwriteProps <
Row extends Record <
string ,
CellScalar
>,
> = Omit <
SheetwriteGridProps ,
| "workbook"
| "data"
| "datasource"
| "height"
| "fill"
> &
GridSizeProps & {
columns : readonly SimpleColumn < Row >[];
defaultRows : readonly Row [];
sheetName ?: string ;
}; Simple framework adapter props for columns and default row objects. API reference → < Row > & { ref ?: ForwardedRef < Grid interface Grid {
readonly store: Store;
readonly actions: GridActions;
setActiveSheet(id: SheetId): void;
scrollToCell(addr: CellAddress): void;
getCellAtPoint(
clientX: number,
clientY: number,
): CellAddress | null;
getActiveSheet(): SheetId;
getCellInput(row: number, col: number): CellInputSnapshot | null;
getSelection(): Selection | null;
setSelection(sel: Selection | null): void;
setTheme(theme: Partial<Theme>): void;
replaceTheme(theme: Partial<Theme> | undefined): void;
// … 106 more lines — see the API reference
} interface Grid {
readonly store : Store ;
readonly actions : GridActions ;
setActiveSheet ( id : SheetId ) : void ;
scrollToCell ( addr : CellAddress ) : void ;
getCellAtPoint (
clientX : number ,
clientY : number ,
) : CellAddress | null ;
getActiveSheet () : SheetId ;
getCellInput ( row : number , col : number ) : CellInputSnapshot | null ;
getSelection () : Selection | null ;
setSelection ( sel : Selection | null ) : void ;
setTheme ( theme : Partial < Theme >) : void ;
replaceTheme ( theme : Partial < Theme > | undefined ) : void ;
// … 106 more lines — see the API reference
} interface Grid {
readonly store : Store ;
readonly actions : GridActions ;
setActiveSheet (
id : SheetId ,
) : void ;
scrollToCell (
addr : CellAddress ,
) : void ;
getCellAtPoint (
clientX : number ,
clientY : number ,
) : CellAddress | null ;
getActiveSheet () : SheetId ;
getCellInput (
row : number ,
col : number ,
) : CellInputSnapshot | null ;
getSelection () : Selection | null ;
// … 229 more lines — see the API reference
} Imperative grid handle for document commands, events, rendering, and teardown. API reference → >;