Tactile vs tinykeys
tinykeys is the best minimal shortcut library: modern
(event.key/event.code, no keyCode), sequences included, ~700 bytes. If your needs stop at
“bind some shortcuts,” use tinykeys and don’t look back — this page exists for when your needs
don’t stop there.
At a glance
Section titled “At a glance”| tinykeys | Tactile | |
|---|---|---|
| Size | ~0.7 kB — 8× smaller | ~5.5 kB |
| Key model | modern (key, code via $mod, explicit) |
modern, hybrid policy per token |
| Cross-platform modifier | $mod |
mod |
| Sequences | ✅ "g i" |
✅ 'g i' |
| Context / scopes | ✗ — gate in your handlers | when expressions |
| Conflicts | ✗ — both handlers fire | detected; one winner by priority |
| Help-dialog introspection | ✗ | getKeymap() with labels |
| User rebinding | ✗ | recording built in |
The honest framing
Section titled “The honest framing”Both libraries got the key model right. The difference is what happens as an app grows:
- Context. With tinykeys, “only in the editor, not read-only, no modal” is
ifstatements in every handler. With Tactile it’swhen: "scope == 'editor' && !readOnly && !modalOpen"— and the help dialog automatically shows only what’s active. - Conflicts. In tinykeys, two subscriptions to
$mod+Kboth fire. Tactile resolves one winner and can tell you about the conflict at registration time. - Product features. Keymap introspection and shortcut recording are the primitives behind “keyboard shortcuts” settings pages — you’d build them by hand on tinykeys.
Side by side
Section titled “Side by side”// tinykeysimport { tinykeys } from 'tinykeys';
const unsubscribe = tinykeys(window, { '$mod+K': openPalette, 'g i': goToInbox,});// Tactileimport { createKeybindingEngine } from '@tactile-js/core';const kb = createKeybindingEngine();
const off1 = kb.add({ id: 'palette', keys: 'mod+k', handler: openPalette });const off2 = kb.add({ id: 'inbox', keys: 'g i', handler: goToInbox });