@sheetwrite/coreinterface
Built-in, separator, or custom callback item in the grid toolbar.
- Package
@sheetwrite/core- Source
packages/core/src/types/grid.ts#L133
Members 4
action Built-in action to bind (or "separator").
action?: ToolbarActionNametype ToolbarActionName =
| "bold"
| "italic"
| "underline"
| "strikethrough"
| "alignLeft"
| "alignCenter"
| "alignRight"
| "textColor"
| "fillColor"
| "border"
| "clearFormat"
| "merge"
| "unmerge"
| "sortAsc"
// … 6 more lines — see the API reference
}type ToolbarActionName =
| "bold"
| "italic"
| "underline"
| "strikethrough"
| "alignLeft"
| "alignCenter"
| "alignRight"
| "textColor"
| "fillColor"
| "border"
| "clearFormat"
| "merge"
| "unmerge"
| "sortAsc"
// … 6 more lines — see the API reference
}type ToolbarActionName =
| "bold"
| "italic"
| "underline"
| "strikethrough"
| "alignLeft"
| "alignCenter"
| "alignRight"
| "textColor"
| "fillColor"
| "border"
| "clearFormat"
| "merge"
| "unmerge"
| "sortAsc"
| "sortDesc"
| "exportCsv"
| "exportXlsx"
| "undo"
// … 2 more lines — see the API reference
}Built-in action names accepted by custom toolbar items.API reference →;Built-in action to bind (or "separator"). Omit when supplying `onClick`.
onClick Custom click handler; receives the grid handle.
onClick?: (grid: Gridinterface 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 →) => void;Custom click handler; receives the grid handle. Overrides `action`.
icon Button icon/content. Strings render as plain text; pass a DOM Node or a factory returning one for SVG/HTML icons without using innerHTML.
icon?: ToolbarIcontype ToolbarIcon = string | Node | (() => Node);type ToolbarIcon = string | Node | (() => Node);type ToolbarIcon =
string | Node | (() => Node);Text, DOM node, or node factory used as toolbar icon content.API reference →;title Accessible tooltip.
title?: string;Declaration
View full TypeScript declaration
export interface ToolbarItem { action?: ToolbarActionNametype ToolbarActionName =
| "bold"
| "italic"
| "underline"
| "strikethrough"
| "alignLeft"
| "alignCenter"
| "alignRight"
| "textColor"
| "fillColor"
| "border"
| "clearFormat"
| "merge"
| "unmerge"
| "sortAsc"
// … 6 more lines — see the API reference
}type ToolbarActionName =
| "bold"
| "italic"
| "underline"
| "strikethrough"
| "alignLeft"
| "alignCenter"
| "alignRight"
| "textColor"
| "fillColor"
| "border"
| "clearFormat"
| "merge"
| "unmerge"
| "sortAsc"
// … 6 more lines — see the API reference
}type ToolbarActionName =
| "bold"
| "italic"
| "underline"
| "strikethrough"
| "alignLeft"
| "alignCenter"
| "alignRight"
| "textColor"
| "fillColor"
| "border"
| "clearFormat"
| "merge"
| "unmerge"
| "sortAsc"
| "sortDesc"
| "exportCsv"
| "exportXlsx"
| "undo"
// … 2 more lines — see the API reference
}Built-in action names accepted by custom toolbar items.API reference →; onClick?: (grid: Gridinterface 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 →) => void; icon?: ToolbarIcontype ToolbarIcon = string | Node | (() => Node);type ToolbarIcon = string | Node | (() => Node);type ToolbarIcon =
string | Node | (() => Node);Text, DOM node, or node factory used as toolbar icon content.API reference →; title?: string;}