function keyboardEventToHotkey(event): Hotkey;
Defined in: parse.ts:248
Converts a KeyboardEvent directly to a hotkey string.
This is a convenience function that combines parseKeyboardEvent() and formatting. The resulting hotkey string uses canonical modifier names (Control, Alt, Shift, Meta) and is suitable for use with useHotkey() and other hotkey functions.
KeyboardEvent
The KeyboardEvent to convert
A hotkey string in canonical form (e.g., 'Control+Shift+S')
document.addEventListener('keydown', (event) => {
const hotkey = keyboardEventToHotkey(event)
console.log(hotkey) // 'Control+Shift+S'
useHotkey(hotkey, () => console.log('Shortcut triggered'))
})