Docs
Cloudflare
Railway
CodeRabbit
Netlify
AG Grid
WorkOS
OpenRouter
SerpAPI
Clerk
Electric
Unkey
Prisma
Sentry
Cloudflare
Railway
CodeRabbit
Netlify
AG Grid
WorkOS
OpenRouter
SerpAPI
Clerk
Electric
Unkey
Prisma
Sentry
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

Type-safe keyboard interactions

TanStackHotkeys

alpha

Keyboard shortcuts that know where they are allowed to fire.

Hotkeys gives apps type-safe shortcut strings, cross-platform Mod handling, scopes, sequences, recording, key state tracking, and framework adapters for serious keyboard interaction systems.

Total DownloadsWeekly DownloadsGitHub Stars
Read the docs

Type-safe strings

validated modifiers and keys

Cross-platform

Mod maps to Cmd or Ctrl

Context-aware

scopes, inputs, cleanup, conflicts

shortcut map

useHotkey("Mod+K", runCommand, { enabled: isPanelOpen })

Why Hotkeys

Keyboard UX is product logic, not an event listener.

Great shortcuts need platform-aware labels, scoped behavior, input safety, conflict avoidance, sequences, recording, and help surfaces. Hotkeys gives those mechanics a typed home.

Shortcut strings are part of the type system.

Define combinations with a type-safe Hotkey string so invalid modifiers and keys get caught before users do.

Mod means the right thing on each platform.

Use one shortcut definition while macOS gets Cmd and other platforms get Ctrl without hand-written platform checks.

Sequences and holds unlock richer UI.

Support Vim-style sequences, multi-step commands, key hold detection, and contextual command flows.

Recording belongs in the product.

Let users capture and customize shortcuts with recorder utilities instead of building keyboard parsing from scratch.

1

Define

Write a type-safe shortcut string with platform-aware modifiers.

2

Scope

Attach it globally, to a document, or to a specific element/ref.

3

Filter

Avoid accidental firing in text inputs or conflicting UI regions.

4

Handle

Run the command, track key state, record input, or render help text.

Shortcut lifecycle

Define, scope, filter, handle.

Hotkeys keeps the full lifecycle explicit so shortcuts feel fast without surprising people while they type, edit, or work inside a focused panel.

Framework adapters

One keyboard core, product-specific command systems.

Use the core shortcut model across UI runtimes, then wire it into the framework adapter and command surface your product needs.

ReactPreactSolidSvelteVueAngular

Open source ecosystem

Hotkeys is for apps where keyboard UX is part of the product.

Maintainers, adapters, examples, partners, and GitHub sponsors keep the shortcut system grounded in real command-heavy interfaces.

GitHub Sponsors

Wow, you've come a long way!
Only one thing left to do...