Key syntax & bindings
A binding is a string (or array of strings). Tactile parses it into one or more chords — a single keystroke with modifier flags and a main key.
Combos
Section titled “Combos”Join keys with +:
'mod+shift+k''ctrl+alt+delete''alt+enter'Sequences
Section titled “Sequences”Separate strokes with spaces. Each stroke must complete within sequenceTimeout (default 1000ms):
'g i' // press g, then i'ctrl+k ctrl+s' // two combos in sequenceThe mod alias
Section titled “The mod alias”Resolves per platform — meta (⌘) on macOS, ctrl on Windows/Linux:
'mod+k' // ⌘K on Mac, Ctrl+K elsewhereWrite one binding instead of maintaining separate Mac/Windows strings.
Alternatives
Section titled “Alternatives”Pass an array — any variant matches:
keys: ['mod+k', 'ctrl+p']Full examples
Section titled “Full examples”kb.add({ id: 'save', keys: 'mod+s', handler: save });kb.add({ id: 'inbox', keys: 'g i', handler: goToInbox });kb.add({ id: 'open', keys: ['mod+o', 'mod+p'], handler: open });kb.add({ id: 'help', keys: '?', handler: help });kb.add({ id: 'delete-line', keys: 'ctrl+shift+delete', handler: deleteLine });Modifier aliases
Section titled “Modifier aliases”| Alias | Modifier |
|---|---|
ctrl, control |
Control |
shift |
Shift |
alt, option, opt |
Alt / Option |
cmd, command, meta, win, super |
Meta / Command |
mod |
Meta on macOS, Control elsewhere |
Named keys
Section titled “Named keys”| Category | Tokens |
|---|---|
| Editing | enter, esc, space, tab, backspace, delete, insert |
| Arrows | up, down, left, right (aliases: arrowup, etc.) |
| Navigation | home, end, pageup, pagedown |
| Function | f1 through f24 |
| Other | capslock |
Symbols
Section titled “Symbols”Type directly or spell out:
| Glyph | Spelled |
|---|---|
? |
— |
/ |
slash |
+ |
plus |
- |
minus |
. |
period, dot |
, |
comma |
; |
semicolon |
' |
quote |
` |
backtick |
= |
equal, equals |
~ |
tilde |
\ |
backslash |
The literal + key
Section titled “The literal + key”Use an empty segment: ctrl++ binds Ctrl + the plus key.
Parse errors
Section titled “Parse errors”Invalid bindings throw KeybindingParseError at registration time:
kb.add({ id: 'bad', keys: 'ctrl+', handler: fn }); // Error: expected a keyDisplay labels
Section titled “Display labels”kb.format('mod+shift+p'); // '⇧⌘P' on macOS, 'Ctrl+Shift+P' elsewhereLabels come from the binding string, not the current OS keyboard layout. See International keyboards.
Match mode per binding
Section titled “Match mode per binding”kb.add({ id: 'a', keys: 'mod+z', match: 'hybrid', handler: undo }); // defaultkb.add({ id: 'b', keys: 'mod+z', match: 'logical', handler: undoAlt }); // characterkb.add({ id: 'c', keys: 'mod+z', match: 'physical', handler: undoPhys }); // keycapSee Match modes.