is-hotkey
Check whether a keyboard event matches a hotkey string like 'mod+s' or 'cmd+alt+space'
Repository Health
Technical Analysis
is-hotkey is a tiny (under 1kb minified+gzipped) utility that answers one question: does this KeyboardEvent match a given hotkey pattern? Instead of hand-rolling event.key/event.which/event.metaKey comparisons, you write hotkeys as natural strings like mod+s, where mod resolves to cmd on Mac and ctrl elsewhere, and pass the browser event straight through.
What You Get
isHotkey(hotkeyString, event)— a single function call returning true/false for a match against aKeyboardEvent- A curried form,
isHotkey(hotkeyString), that returns a reusable matcher function so the hotkey string is parsed only once - Cross-platform
modkeyword that resolves tocmdon macOS andctrlon Windows/Linux automatically - Support for matching via either
event.which(default, broadest compatibility) orevent.key(layout-independent) depending on configuration
Common Use Cases
- Wiring keyboard shortcuts (save, bold, undo) in a rich-text editor or WYSIWYG component’s
onKeyDownhandler - Adding app-wide keyboard shortcuts (command palette, search focus) without a full hotkey-management framework
- Building editor or IDE-like web UIs that need to distinguish
cmd+son Mac fromctrl+son Windows with one hotkey string - Performance-sensitive keydown handlers that curry a hotkey matcher once and reuse it across many events
Under The Hood
Architecture The entire implementation lives in a single 222-line file (src/index.js): a hotkey string like mod+alt+s is split on +, each token normalized against a lookup table of key aliases and modifier names (including the special cross-platform mod token), then compared against the event’s modifier flags (metaKey, ctrlKey, altKey, shiftKey) and its key code or key value. Tech Stack Plain ES2015+ JavaScript compiled with Babel to CommonJS (lib/index.js) plus a UMD build (lib/is-hotkey.umd.js) for direct <script> usage, with zero runtime dependencies — the package is intentionally kept under 1kb minified and gzipped. Code Quality A 259-line Mocha test suite in test/index.js exercises the parser and matcher against a range of hotkey strings and simulated events, giving solid coverage relative to the library’s small surface area, though the project has seen no formal releases logged on GitHub despite ongoing commits, suggesting slower, informal maintenance cadence. API Design The API is a single function with two calling conventions — direct isHotkey(str, event) for one-off checks, or curried isHotkey(str)(event) when the same hotkey will be tested repeatedly — which keeps integration to one line of code in a keydown handler with no configuration objects or setup required for the common case.
Used by 11 apps in this directory
APITable
Low Code Platforms · Databases
API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.
Colanode
Knowledge Management · Team Chat · Collaboration
Local-first, self-hosted workspace that combines real-time chat, Notion-style pages, and structured databases — all synced via CRDTs so you work offline without losing a keystroke.
Dittofeed
Marketing · Automation
Open-source omni-channel customer engagement platform for automating transactional and marketing messages via email, SMS, WhatsApp, Slack, and mobile push.
Drawnix
Design Tools · Productivity
All-in-one open-source whiteboard combining mind maps, flowcharts, and freehand drawing on a single infinite canvas.
Grafana
Monitoring · Analytics
The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.
KeystoneJS
CMS · Developer Tools
The superpowered headless CMS for developers built with GraphQL and React
Notifuse
Marketing
Open-source, self-hosted alternative to Mailchimp, Brevo, and Klaviyo — send newsletters and transactional emails without per-email pricing or vendor lock-in.
Plasmic
CMS · Low Code Platforms · No Code Platforms
The open-source visual builder that lets teams design React apps and websites with drag-and-drop while integrating seamlessly with your codebase.
supermemory
AI Development · Productivity · Note Taking
The state-of-the-art memory and context engine for AI agents — ranked #1 on all three major AI memory benchmarks.