Usage
Registers global keyboard shortcuts with a single window keydown listener per hook instance. Handlers live in a ref, so re-renders never re-subscribe. Skips events from typing targets (input, textarea, select, contenteditable) unless allowInInputs, skips defaultPrevented events, and calls preventDefault() on match. SSR-safe.
tsimport {useHotkeys} from '@astryxdesign/core/hooks'
Best practices
| Guidance | Practices |
|---|---|
| Do | Use for app-level shortcuts like command palettes (mod+k), help overlays (shift+/), and navigation keys. |
| Do | Pair with the Kbd component to display the same combo you register; both resolve "mod" per platform identically. |
| Do | Use isDisabled to suspend shortcuts while a modal or wizard owns the keyboard, instead of unmounting the hook. |
| Don't | Use for focus-scoped keyboard navigation inside a widget; use useListFocus or useGridFocus instead. |
Parameters
| Param | Type | Description |
|---|---|---|
hotkeysrequired | [] | Shortcut registrations. Each entry: |