useKeyCombo
Events
A React hook that detects when a specific combination of keys is pressed simultaneously, useful for implementing keyboard shortcuts and hotkeys.
Installation
npm install @thibault.sh/hooks
API Reference
Signature
type KeyCombo = string[];
function useKeyCombo(targetCombo: KeyCombo): boolean
Parameters
Name | Type | Description | Default |
---|---|---|---|
targetCombo | KeyCombo (string[]) | Array of key names that make up the combination. | - |
Returns
boolean
Boolean indicating if all keys in the combination are currently pressed.