File tree Expand file tree Collapse file tree
apps/docs/src/pages/composables/system Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,6 +63,34 @@ The `useHotkey` composable registers hotkey handlers on the window with automati
6363</template>
6464```
6565
66+ ## Key Aliases
67+
68+ Key strings are normalized before matching, so you can use human-friendly names instead of exact ` KeyboardEvent.key ` values:
69+
70+ | Alias | Canonical |
71+ | - | - |
72+ | ` esc ` | ` escape ` |
73+ | ` return ` | ` enter ` |
74+ | ` del ` | ` delete ` |
75+ | ` space ` , ` spacebar ` | ` ` (space character) |
76+ | ` up ` / ` down ` / ` left ` / ` right ` | ` arrowup ` / ` arrowdown ` / ` arrowleft ` / ` arrowright ` |
77+ | ` control ` | ` ctrl ` |
78+ | ` command ` | ` cmd ` |
79+ | ` option ` | ` alt ` |
80+ | ` plus ` | ` + ` |
81+ | ` minus ` , ` hyphen ` | ` - ` |
82+ | ` slash ` | ` / ` |
83+ | ` underscore ` | ` _ ` |
84+
85+ ``` ts no-filename
86+ // These are equivalent:
87+ useHotkey (' escape' , close )
88+ useHotkey (' esc' , close )
89+
90+ useHotkey (' ctrl+plus' , zoomIn ) // matches Ctrl ++
91+ useHotkey (' cmd+minus' , zoomOut ) // matches Cmd +-
92+ ```
93+
6694## Architecture
6795
6896` useHotkey ` builds on ` useEventListener ` for keyboard event handling:
You can’t perform that action at this time.
0 commit comments