Safe by default
Matches on event.key, not event.code — works across all keyboard layouts.
Body text. The quick brown fox jumps over the lazy dog. This is a paragraph demonstrating the base typographic style — Lilex Variable throughout, with lighter weight for headings and display numbers.
Bold text and italic text and strikethrough text and inline code and a link to somewhere.
Blockquote. Design is not just what it looks like and feels like. Design is how it works.
— Steve Jobs
key
: The value returned by KeyboardEvent.key. This is what hotter-keys matches on.
code
: The physical key position. Layout-dependent — do not use.
Inline: createHotkeys({ target: document.body })
import { createHotkeys } from "@hotter-keys/core";
const hk = createHotkeys({ target: document.body });
// Single shortcuthk.add("ctrl+k", () => { console.log("Command palette opened");});
// Key sequence (chord)hk.add("ctrl+k ctrl+c", () => { console.log("Comment block");});
// Held-keys trackinghk.onHeldKeysChange((keys) => { console.log("Currently held:", keys);});:root { --hk-card-bg: #e4e4da; --hk-card-border: rgba(26, 26, 23, 0.1); --hk-rule: rgba(26, 26, 23, 0.07); --hk-danger: #c45040;}{ "entries": [ { "name": "save", "shortcut": "ctrl+s" }, { "name": "undo", "shortcut": "ctrl+z" } ]}| Property | Type | Default | Description |
|---|---|---|---|
target | HTMLElement | — | The element to listen on |
timeout | number | 1000 | Sequence timeout in ms |
suppress | boolean | true | Prevent default on match |
A wider table:
| Key | Code | keyCode | Deprecated | Layout-aware | Safe |
|---|---|---|---|---|---|
a | KeyA | 65 | No | Yes | Yes |
ArrowUp | ArrowUp | 38 | No | N/A | Yes |
Alt | AltLeft | 18 | No | N/A | No |
Inline badges: New Deprecated Beta Note Default Tip
Sizes: Small Medium Large
Safe by default
Matches on event.key, not event.code — works across all keyboard layouts.
Key sequences
Multi-chord shortcuts like Ctrl+K Ctrl+C with configurable timeout.
Held-keys tracking
Real-time tracking of which keys are currently pressed.
Shortcut recording
Built-in recordShortcut() utility with safety validation.
{ "entries": [ { "id": "1", "name": "save", "description": "Save file", "shortcut": "ctrl+s" }, { "id": "2", "name": "undo", "description": "Undo last action", "shortcut": "ctrl+z" }, { "id": "3", "name": "comment", "description": "Toggle comment", "shortcut": "ctrl+k ctrl+c" } ]}Press Ctrl + K then Ctrl + C to comment a block.
The API uses HTML keyboard events.
E = mc2 and H2O.
A standalone gauge at different values: