@sheetwrite/core/shellfunction
Mount a toolbar bound to grid.actions (custom items receive the grid).
Mouse clicks never steal grid focus; keyboard users get local
Left/Right/Home/End movement across the controls while the toolbar has
focus. Returns the mounted piece with an idempotent destroy.
- Package
@sheetwrite/core/shell- Source
packages/core/src/shell/toolbar-factory.ts#L27
Declaration
function createToolbar( host: HTMLElement, 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 →, options?: ToolbarOptionsinterface ToolbarOptions {
items?: readonly ToolbarItem[];
icons?: Partial<Record<ToolbarActionName, ToolbarIcon>>;
label?: string;
}interface ToolbarOptions {
items?: readonly ToolbarItem[];
icons?: Partial<Record<ToolbarActionName, ToolbarIcon>>;
label?: string;
}interface ToolbarOptions {
items?: readonly ToolbarItem[];
icons?: Partial<
Record<
ToolbarActionName,
ToolbarIcon
>
>;
label?: string;
}Host element and configuration used to create the built-in toolbar.API reference →,): ShellPieceinterface ShellPiece {
readonly element: HTMLElement;
destroy(): void;
}interface ShellPiece {
readonly element: HTMLElement;
destroy(): void;
}interface ShellPiece {
readonly element: HTMLElement;
destroy(): void;
}A mounted shell piece: its root element plus an idempotent teardown.API reference →