
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@keybindy/core
Advanced tools
A lightweight and framework-agnostic keyboard shortcut manager for web apps. Define, register, and handle keybindings with ease.
Keybindy is a lightweight, fast, and framework-agnostic TypeScript library for managing keyboard shortcuts in JavaScript applications. With a small footprint and zero dependencies, Keybindy makes it easy to register, manage, and scope keyboard shortcuts in any environment — whether you're building with vanilla JavaScript, Vue, Svelte, or another framework.
The @keybindy/core package is the foundation of the Keybindy ecosystem, providing all the logic for keyboard shortcut management. For React developers, the optional @keybindy/react package offers seamless integration.
Keyboard shortcuts are essential for productivity and a smooth user experience — but managing them across components, contexts, and frameworks can quickly become a nightmare.
That’s where Keybindy comes in.
Other shortcut libraries often come with:
Keybindy is a blazing-fast, ultra-lightweight TypeScript-first solution for handling keyboard shortcuts.
It’s designed to be:
Whether you're building a single-page app, a design tool, or a productivity suite — Keybindy gives you total control over keyboard interactions without the baggage.
Ctrl+S for saving)cmd → meta, ctrl (left) | ctrl (right) → ctrl, etc.Install the core package using your preferred package manager:
# npm
npm install @keybindy/core
# yarn
yarn add @keybindy/core
# bun
bun add @keybindy/core
Or use via CDN (URL coming soon):
<script src="https://unpkg.com/@keybindy/core@1.1.4/dist/keybindy.min.js"></script>
// With import
import ShortcutManager from '@keybindy/core';
const manager = new ShortcutManager();
// With CDN
const manager = new Keybindy();
// Register "Enter" to submit a form in the "modal" scope
manager.register(
['Enter'],
() => {
console.log('Submitting modal form...');
},
{ scope: 'modal', preventDefault: true }
);
// Activate the modal scope (e.g., when modal opens)
manager.setActiveScope('modal');
startStarts the manager manually. This is usually not required, as the manager starts automatically on instantiation.
manager.start();
registerRegisters a new shortcut.
| Parameter | Type | Required | Description |
|---|---|---|---|
keys | Keys[] | ✅ | Keys to bind (e.g., ["ctrl", "shift", "k"]) |
handler | ShortcutHandler | ✅ | Callback to execute when the shortcut is triggered. |
options | ShortcutOptions | ❌ | Optional config (scope, preventDefault, metadata, etc.) |
manager.register(
['ctrl', 'shift', 'k'],
() => {
console.log('Triggered Ctrl+Shift+K');
},
{
preventDefault: true,
scope: 'modal',
sequential: true,
sequenceDelay: 1000,
data: {
// metadata
label: 'Ctrl+Shift+K',
description: 'Submit form',
},
}
);
ShortcutOptionsThe options object allows you to customize the behavior of a shortcut.
| Option | Type | Default | Description |
|---|---|---|---|
scope | string | "global" | The scope in which the shortcut is active. |
preventDefault | boolean | false | If true, calls event.preventDefault() to block the browser's default action. |
sequential | boolean | false | If true, treats the key combination as a sequence (e.g., G then H). |
sequenceDelay | number | 1000 | The maximum time (in ms) between key presses for a sequential shortcut. |
triggerOn | string | "keydown" | For simultaneous shortcuts, specifies whether to trigger on "keydown" or "keyup". |
hold | boolean | false | If true, treats the shortcut as a "hold" action. The handler will be called on both key down and key up with a state argument ("down" or "up"). |
repeat | boolean | false | If true, allows the shortcut to be repeatedly fired when the key is held down. By default, shortcuts only fire once. |
data | object | {} | An object for any custom metadata you want to associate with the shortcut, useful for building features like cheat sheets. |
unregisterRemoves a previously registered shortcut.
| Parameter | Type | Required | Description |
|---|---|---|---|
keys | Keys[] | ✅ | The keys to unbind. |
manager.unregister(['ctrl', 'shift', 'k']);
enable / disable / toggleEnables, disables, or toggles a shortcut on or off.
| Parameter | Type | Required | Description |
|---|---|---|---|
keys | Keys[] | ✅ |
manager.enable(['ctrl', 's']);
manager.disable(['ctrl', 's']);
manager.toggle(['ctrl', 's']);
enableAll / disableAllEnable or disable all shortcuts — globally or within a specific scope.
| Parameter | Type | Required | Description |
|---|---|---|---|
scope | string | ❌ | scope to enable/disable all shortcuts. |
manager.enableAll(); // Global
manager.enableAll('modal'); // Scoped
manager.disableAll(); // Global
manager.disableAll('modal'); // Scoped
getCheatSheetReturns a list of all registered shortcuts. Optionally scoped.
| Parameter | Type | Required | Description |
|---|---|---|---|
scope | string | ❌ | scope to get cheat sheet. |
manager.getCheatSheet();
getScopesReturns all registered scopes.
manager.getScopes();
getActiveScopeReturns the currently active scope.
manager.getActiveScope();
setActiveScopeSets the current active scope.
| Parameter | Type | Required | Description |
|---|---|---|---|
scope | string | ✅ | The scope to set. |
manager.setActiveScope('modal');
isScopeActiveChecks if a specific scope is currently active.
| Parameter | Type | Required | Description |
|---|---|---|---|
scope | string | ✅ | The scope to check. |
manager.isScopeActive('modal');
getScopesInfoReturns information about all scopes or a specific one.
| Parameter | Type | Required | Description |
|---|---|---|---|
scope | string | ❌ | scope to get info. |
manager.getScopesInfo();
manager.getScopesInfo('modal');
pushScope / popScope / resetScopeManage the scope stack.
manager.pushScope('modal');
manager.popScope();
manager.resetScope();
destroyFully destroys the manager instance and removes all bindings.
manager.destroy();
clearClears the internal state without destroying the instance.
manager.clear();
onTypingListen for every typed key. Useful for custom behavior or analytics.
manager.onTyping(({ key, event }) => {
console.log(`Key typed: ${key}`, event);
});
@keybindy/core is designed to provide a flexible and powerful foundation for keyboard shortcut management. This section outlines the core ideas and keybinding types supported by the library.
We support three primary types of key combinations:
These are keybindings where the user presses keys one after another, like:
g → h
This style is commonly seen in editors like Vim or platforms like GitHub, where pressing g followed by h might trigger navigation (e.g., go to the homepage).
sequenceDelay: Sets the max time (in ms) allowed between keys.manager.register(
...,
...,
{
sequential: true,
sequenceDelay: 1000
});
These are triggered when multiple keys are held down together, like:
Ctrl + K
Meta + Shift + P
Perfect for standard "shortcut-style" commands that fire instantly when all keys are down at once.
manager.register(
...,
...
);
These are special shortcuts that trigger on both key down and key up. They are ideal for actions that need to persist while a key is held, such as a "push-to-talk" feature.
state argument ("down" or "up").manager.register(
['Ctrl', 'Shift'],
(event, state) => {
console.log(`Mic is ${state === 'down' ? 'on' : 'off'}`);
},
{ hold: true }
);
@keybindy/core supports aliasing of platform-specific key variations, so your shortcuts work consistently across different operating systems and keyboard layouts:
ctrl (left) / ctrl (right) → ctrlshift (left) / shift (right) → shiftalt (left) / alt (right) → altmeta (left) / meta (right) → metacmd → metaenter / numpad enter → enterKeybindy has modular packages for different platforms. Each package is built to work seamlessly with the core engine.
| Package | Description |
|---|---|
@keybindy/core | The core JavaScript library. Framework-agnostic, fully typed, and tree-shakable. |
@keybindy/react | React bindings with hooks and components for easy integration. |
| Coming Soon | Stay tuned! |
PRs, issues, and ideas are welcome! See CONTRIBUTING.md for details.
If you're adding a new framework integration (like Vue or Svelte), feel free to open a draft PR — we'd love to collaborate.
Might be new in the shortcut game, but Keybindy’s here to change the frame — fast, flexible, and ready to claim. 🎯
FAQs
A lightweight and framework-agnostic keyboard shortcut manager for web apps. Define, register, and handle keybindings with ease.
We found that @keybindy/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.