Get the action
npx lomer-ui action hotkey
Action
Hotkey
Triggers actions with keyboard shortcuts.
Installation
Get the action
npx lomer-ui action hotkey
Usage
Preview
Press "F".
Press "Ctrl + F".
Press "Shift + Alt + F".
Svelte Code
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 | |
Parameters
Parameter | Type | Description |
---|---|---|
options.key | string | The key that triggers the "onKeydown" function when pressed. |
options.onKeydown | (event: KeyboardEvent) => void | A callback function that executes when the specified key is pressed. |
options.ctrlKey | boolean | Whether the Ctrl key must be held while pressing the key. |
options.metaKey | boolean | Whether the Meta key (⌘ on macOS) must be held. |
options.shiftKey | boolean | Whether the Shift key must be held. |
options.altKey | boolean | Whether the Alt (Option on macOS) key must be held. |