Adding keyboard shortcuts to a React app — a ⌘K palette, single keys, or Gmail-style `g then i` sequences — with correct cross-platform modifier handling.
Overview
useHotkeys with combos (mod+k), key sequences (g then d), scopes and pretty display formatting (⌘K). SSR-safe and respects form fields.
Install
$ npm install @lacspace/hotkeys
Quick example
@lacspace/hotkeysts
useHotkeys("mod+k", openPalette)
Key API
useHotkeys(keys, handler, options?, deps?)Bind one or many combos/sequences; options for scope, target, form-tags.
parseHotkey(str) / matchesHotkey(e, str)Parse and test combos yourself.