Go back

🔥 TanStack Releases Hotkeys: Type-Safe Keyboard Shortcut Management

TanStack Hotkeys brings type-safe shortcuts, sequences, scoped hotkeys, DevTools, and React hooks in a new pre-alpha library.

🔥 TanStack Releases Hotkeys: Type-Safe Keyboard Shortcut Management

A new library in the TanStack ecosystem for working with keyboard shortcuts: framework-agnostic, strongly typed, and ready for complex scenarios.

⚡️ Main features

1. A type-safe API out of the box

Keyboard shortcuts are described as strings or objects with full TypeScript support.

2. Framework-agnostic

It doesn’t just work with React: you can use it in any project.

3. A cross-platform Mod key

One syntax (Mod) for Cmd on macOS and Ctrl on Windows/Linux.

4. Sequence support (Vim-style)

You can define complex combinations and sequences of keys.

5. Key state tracking

You can track which modifier keys are held down.

6. Hotkey recording

Utilities are available for building shortcut customization interfaces.

7. Scoped hotkeys

Bind shortcuts to specific elements rather than the entire document.

8. A singleton Hotkey Manager

Centralized keyboard shortcut management.

9. DevTools out of the box

For debugging and inspecting active shortcuts.

10. React hooks out of the box

For example, useHotkey, with lifecycle management and protection against stale closures.

🧠 When this is useful

Admin panels, editors, IDE-like interfaces, customizable keyboard shortcuts, complex keyboard flows, accessibility, and productivity.

⚠️ Status

The library is in pre-alpha, and the API may change.

Documentation

Copied