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+↵
127
NPM Downloads
44
Stars on Github
6
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

Partners

CodeRabbit
Cloudflare
AG Grid
Netlify
WorkOS
Neon
Clerk
Convex
Electric
Sentry
Railway
PowerSync
Prisma
Strapi
Unkey
Fireship
Nozzle.io
Hotkeys You?
We're looking for TanStack Hotkeys Partners to join our mission! Partner with us to push the boundaries of TanStack Hotkeys and build amazing things together.
Let's chat
Wow, you've come a long way!
Only one thing left to do...