Skip to content
tactile

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.

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

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 if statements in every handler. With Tactile it’s when: "scope == 'editor' && !readOnly && !modalOpen" — and the help dialog automatically shows only what’s active.
  • Conflicts. In tinykeys, two subscriptions to $mod+K both 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.
// tinykeys
import { tinykeys } from 'tinykeys';
const unsubscribe = tinykeys(window, {
'$mod+K': openPalette,
'g i': goToInbox,
});
// Tactile
import { 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 });