My App
BoardKitFrontend

Keyboard Shortcuts

useKeyboardShortcuts hook and shortcut reference

useKeyboardShortcuts registers global keyboard event handlers for common whiteboard operations.

Signature

function useKeyboardShortcuts(): void;

No return value — the hook only registers side effects. Call it once in your whiteboard component.

Usage

import { useKeyboardShortcuts } from '@hfu.digital/boardkit-react';

function Whiteboard() {
    useKeyboardShortcuts();

    return <BoardCanvas />;
}

Shortcut Reference

General

ShortcutAction
Ctrl+ZUndo
Ctrl+Y or Ctrl+Shift+ZRedo
Ctrl+ASelect all elements
Ctrl+CCopy selected elements
Ctrl+VPaste at viewport center
Ctrl+DDuplicate selected (offset +20, +20)
Delete or BackspaceDelete selected elements
Ctrl+GGroup selected (placeholder)
Ctrl+Shift+FFit viewport to content
Ctrl+0Reset zoom to 100%

Tool Switching (Number Keys)

KeyTool
1Select
2Pen
3Shape
4Text
5Eraser
6Hand (pan)
7Sticky Note
8Connector
9Laser

Behavior Notes

  • Shortcuts are disabled when the focus is in an <input>, <textarea>, or contentEditable element
  • Copy/paste uses an internal clipboard (not the system clipboard) for element serialization
  • Paste places elements at the center of the current viewport
  • Duplicate offsets elements by (+20, +20) pixels from the original position
  • Ctrl and Cmd (Meta) are treated equivalently for macOS compatibility

On this page