Installation
Install react-hotkeys-hook using your preferred package manager:Requirements
react-hotkeys-hook has minimal peer dependencies:- React:
>=16.8.0(Hooks support required) - React DOM:
>=16.8.0
react-hotkeys-hook uses React Hooks, so it requires React 16.8 or later. Make sure your project meets this requirement before installing.
TypeScript Support
react-hotkeys-hook is written in TypeScript and includes type definitions out of the box. No additional@types packages are needed.
Verify Installation
After installation, verify that the package is correctly installed by importing it in your project:Framework-Specific Setup
Next.js
react-hotkeys-hook works seamlessly with Next.js (both Pages Router and App Router). No additional configuration is needed.Vite
No special configuration required. Just install and import:Create React App
Works out of the box with Create React App:Remix
Compatible with Remix. Use in client-side components:What’s Included
When you install react-hotkeys-hook, you get access to:useHotkeys- The main hook for listening to keyboard shortcutsuseRecordHotkeys- A hook for recording keyboard shortcutsHotkeysProvider- A context provider for managing scopesuseHotkeysContext- Access the hotkeys contextisHotkeyPressed- Check if a key is currently pressed- Full TypeScript type definitions
Next Steps
Now that you have react-hotkeys-hook installed, continue to the Quick Start guide to learn how to use it:Quick Start
Learn how to use react-hotkeys-hook with practical examples
