is-hotkey

Check whether a keyboard event matches a hotkey string like 'mod+s' or 'cmd+alt+space'

Library
npm
v0.2.0
375stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
44/100Fair
Development Activity44
Maintenance8
Community44
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
66/100Good
Architecture62
Code Quality65
Innovation50
Learning Curve85

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 a KeyboardEvent
  • A curried form, isHotkey(hotkeyString), that returns a reusable matcher function so the hotkey string is parsed only once
  • Cross-platform mod keyword that resolves to cmd on macOS and ctrl on Windows/Linux automatically
  • Support for matching via either event.which (default, broadest compatibility) or event.key (layout-independent) depending on configuration

Common Use Cases

  • Wiring keyboard shortcuts (save, bold, undo) in a rich-text editor or WYSIWYG component’s onKeyDown handler
  • 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+s on Mac from ctrl+s on 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

TypeScript
72%
AGPL 3.0

APITable

Low Code Platforms · Databases

15,526

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
53
Repo Health
77
Technical
60
Dependency
Built with
TypeScript72%
Java22%
Updated 9 months ago
TypeScript
99%
Apache 2.0

Colanode

Knowledge Management · Team Chat · Collaboration

5,018

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.

View details
47
Repo Health
73
Technical
73
Dependency
Built with
TypeScript99%
Updated 4 months ago
TypeScript
92%
MIT

Dittofeed

Marketing · Automation

2,903

Open-source omni-channel customer engagement platform for automating transactional and marketing messages via email, SMS, WhatsApp, Slack, and mobile push.

View details
54
Repo Health
75
Technical
63
Dependency
Built with
TypeScript92%
Updated 4 months ago
TypeScript
88%
MIT

Drawnix

Design Tools · Productivity

14,567

All-in-one open-source whiteboard combining mind maps, flowcharts, and freehand drawing on a single infinite canvas.

View details
73
Repo Health
69
Technical
83
Dependency
Built with
TypeScript88%
SCSS10%
Updated 3 days ago
TypeScript
48%
AGPL 3.0

Grafana

Monitoring · Analytics

76,300

The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.

View details
95
Repo Health
91
Technical
65
Dependency
Built with
TypeScript48%
Go46%
Updated today
TypeScript
99%
MIT

KeystoneJS

CMS · Developer Tools

9,957

The superpowered headless CMS for developers built with GraphQL and React

View details
91
Repo Health
81
Technical
64
Dependency
Built with
TypeScript99%
Updated yesterday
Go
74%
Other

Notifuse

Marketing

2,048

Open-source, self-hosted alternative to Mailchimp, Brevo, and Klaviyo — send newsletters and transactional emails without per-email pricing or vendor lock-in.

View details
82
Repo Health
80
Technical
68
Dependency
Built with
Go74%
TypeScript23%
Updated yesterday
TypeScript
84%
MIT

Plasmic

CMS · Low Code Platforms · No Code Platforms

6,961

The open-source visual builder that lets teams design React apps and websites with drag-and-drop while integrating seamlessly with your codebase.

View details
81
Repo Health
78
Technical
65
Dependency
Built with
TypeScript84%
Updated today
TypeScript
77%
MIT

supermemory

AI Development · Productivity · Note Taking

28,954

The state-of-the-art memory and context engine for AI agents — ranked #1 on all three major AI memory benchmarks.

View details
88
Repo Health
82
Technical
69
Dependency
Built with
TypeScript77%
MDX17%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search