Docs
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
API Reference
Hotkeys API Reference
Hotkey Sequence API Reference
Key hold & held keys API Reference
Hotkey Recorder API Reference
Hotkey Sequence Recorder API Reference
Normalization & format API Reference

TanStackHotkeys
ALPHA

Type-safe keyboard shortcuts, sequences, and key state tracking for your apps

A type-safe, cross-platform hotkey library with sequence detection, key state tracking, hotkey recording, and framework adapters for React and more.

Get Started Ctrl/Cmd+Enter
0
NPM Downloads
0
Stars on GitHub
0
Contributors on GitHub
0
Dependents on GitHub

Type-Safe & Cross-Platform

Define keyboard shortcuts with a fully type-safe Hotkey string type that validates key combinations at the type level. Cross-platform Mod modifier automatically maps to Cmd on macOS and Ctrl elsewhere, so your shortcuts work everywhere without platform checks.

Better Defaults

Ships with sensible and safe defaults, including automatic preventDefault and stopPropagation, smartly ignoring shortcuts when input fields are focused, and automatic cleanup on unmount. Scoping hotkeys to refs or elements is easy, making it straightforward to define context-aware keyboard shortcuts without unexpected side-effects.

Sequences & Recording

Build multi-step keyboard sequences like Vim-style commands or cheat codes with configurable timeouts. Let users record and customize their own shortcuts with the built-in hotkey recorder that captures modifier and key combinations in real time.

Type-Safe & Feature Rich

TanStack Hotkeys provides a complete keyboard interaction toolkit with type safety and cross-platform support built in.

Type-Safe Hotkey Strings Cross-Platform Mod Modifier Keyboard Sequences Hotkey Recording Key Hold Detection Document or Element Scoping Conflict Warnings Input Element Filtering Display Formatting Utilities Singleton HotkeyManager Framework Agnostic Core Awesome Devtools! Automatic Cleanup Cheat Sheet Utilities Lightweight & Tree-Shakeable
Wow, you've come a long way!
Only one thing left to do...