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
| Shortcut | Action |
|---|---|
Ctrl+Z | Undo |
Ctrl+Y or Ctrl+Shift+Z | Redo |
Ctrl+A | Select all elements |
Ctrl+C | Copy selected elements |
Ctrl+V | Paste at viewport center |
Ctrl+D | Duplicate selected (offset +20, +20) |
Delete or Backspace | Delete selected elements |
Ctrl+G | Group selected (placeholder) |
Ctrl+Shift+F | Fit viewport to content |
Ctrl+0 | Reset zoom to 100% |
Tool Switching (Number Keys)
| Key | Tool |
|---|---|
1 | Select |
2 | Pen |
3 | Shape |
4 | Text |
5 | Eraser |
6 | Hand (pan) |
7 | Sticky Note |
8 | Connector |
9 | Laser |
Behavior Notes
- Shortcuts are disabled when the focus is in an
<input>,<textarea>, orcontentEditableelement - 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
CtrlandCmd(Meta) are treated equivalently for macOS compatibility