Skip to content

GridConfig@sheetwrite/core

On this page

Toolbar / feature configuration. When config is set the built-in toolbar is shown; control flags default to true except the opt-in export flag.

Examples

import type { GridConfig } from "@sheetwrite/core";
const config: GridConfig = {
toolbar: true,
contextMenu: [{ action: "copy" }, { action: "paste" }],
keyboard(event, grid) {
if (event.altKey && event.key === "b") {
return true;
}
return false;
},
};

See also

Members 17

toolbar Show the built-in toolbar (true), hide it (false), or supply a custom item list.
toolbar?: boolean | ToolbarItem[];
bold Show the bold control in the default toolbar (default true).
bold?: boolean;
italic Show the italic control in the default toolbar (default true).
italic?: boolean;
align Show left, center, and right alignment controls (default true).
align?: boolean;
textColor Show the text-color control in the default toolbar (default true).
textColor?: boolean;
fillColor Show the fill-color control in the default toolbar (default true).
fillColor?: boolean;
border Show the border control in the default toolbar (default true).
border?: boolean;
clearFormat Show the clear-format control in the default toolbar (default true).
clearFormat?: boolean;
merge Show merge and unmerge controls in the default toolbar (default true).
merge?: boolean;
sort Show ascending and descending sort controls in the default toolbar (default true).
sort?: boolean;
export Show CSV/XLSX export controls in the default toolbar (default false).
export?: boolean;
icons Override built-in toolbar icons by action name.
icons?: Partial<Record<ToolbarActionName, ToolbarIcon>>;

Override built-in toolbar icons by action name. Strings render as plain text; DOM nodes/factories support SVG/HTML icons.

contextMenu Built-in menu, disabled menu, static rows, or a request-aware row factory.
contextMenu?: boolean | ContextMenuItems;
undo Show undo/redo controls in the built-in toolbar (default true).
undo?: boolean;
find Built-in Ctrl+F find widget: enabled (true, default) or disabled (false).
find?: boolean;
tabs Bottom sheet-tab bar for multi-sheet workbooks (default true).
tabs?: boolean;
keyboard Built-in keyboard handling.
keyboard?: boolean | KeyboardOptions | ((e: KeyboardEvent, grid: Grid) => boolean);

Built-in keyboard handling. `true` (default) keeps the stock Sheets-style bindings. An object replaces individual action bindings; omitted actions keep their defaults, and `null` disables an action's keys. For example: `{ bindings: { copy: { key: "c", mod: true, shift: true } } }`. Menu hints and toolbar titles use these same bindings. `false` disables all built-in keys. A function intercepts each keydown before the defaults; return true to consume it, false to let the built-in handler continue.

Declaration

View full TypeScript declaration
export interface GridConfig {
toolbar?: boolean | ToolbarItem[];
bold?: boolean;
italic?: boolean;
align?: boolean;
textColor?: boolean;
fillColor?: boolean;
border?: boolean;
clearFormat?: boolean;
merge?: boolean;
sort?: boolean;
export?: boolean;
icons?: Partial<Record<ToolbarActionName, ToolbarIcon>>;
contextMenu?: boolean | ContextMenuItems;
undo?: boolean;
find?: boolean;
tabs?: boolean;
keyboard?:
boolean | KeyboardOptions | ((e: KeyboardEvent, grid: Grid) => boolean);
}

Referenced by

Workspace packages depending on @sheetwrite/core

  • @sheetwrite/benchdependency
  • @sheetwrite/docs-startdependency
  • @sheetwrite/reactdependency
  • @sheetwrite/sveltedependency
  • @sheetwrite/vuedependency
  • @sheetwrite/xlsxdependency

Public exports naming GridConfig

Documentation