finds.dev

jamiebuilds/tinykeys

A tiny (~650 B) & modern library for keybindings.

View on GitHubHomepage ↗

★ 4,087TypeScriptMITupdated May 2026

// the take

tinykeys is a sub-1KB library for registering keyboard shortcuts, supporting both single combos and multi-key sequences. It matches against both KeyboardEvent.key and KeyboardEvent.code, handles cross-platform modifiers via $mod, and ships with zero dependencies. Aimed at any web app that needs hotkeys without pulling in a heavier solution.

The $mod abstraction for Cmd/Ctrl cross-platform shortcuts is exactly right and saves everyone from writing the same platform-detection branch. Sequence support (vim-style 'g i', 'g a') is genuinely useful and the 1000ms window is sensible. The optional modifier syntax ([Shift]+?) covers real-world cases like '?' without requiring the user to hold Shift explicitly. Returns an unsubscribe function, which makes React useEffect cleanup a one-liner.

Keybinding priority is declaration-order dependent and the conflict resolution is surprising — a prefix binding ('g') silently eats any sequence starting with it, and you only find out from a console warning, not a thrown error. The ignore filter for inputs is a good default but there is no built-in way to scope bindings to a specific element subtree without wiring up createKeybindingsHandler yourself. Regex key matching via parentheses is an odd extension to the syntax that only works on the key portion, not modifiers, which will confuse anyone who reaches for it expecting uniform behavior. With 89 forks and apparent low maintainer bandwidth, issues tend to sit.

We read the README, the directory tree and a key source file in July 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
4,087
Forks
89
Language
TypeScript
License
MIT
Last commit
26 May 2026

// nearby

If tinykeys isn't quite it.

All repos →