
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
@luxonauta/use-hotkeys
Advanced tools
đ A React hook for registering one or more keyboard shortcuts
useHotkeysA React hook for handling keyboard shortcuts and hotkey sequences.
npm install @luxonauta/use-hotkeys
import useHotkeys from "@luxonauta/use-hotkeys";
export const Component = () => {
useHotkeys("Control+k", (event) => {
event.preventDefault();
console.log("Control+K was pressed");
});
return <p>Press Control+K</p>;
};
import { useHotkeysWithState } from "@luxonauta/use-hotkeys";
export const Component = () => {
const indicator = useHotkeysWithState(
"Escape",
() => {
console.log("Escape pressed");
},
{ returnState: true }
);
return (
<div>
<p>Press Escape</p>
<pre>{JSON.stringify(indicator, null, 2)}</pre>
</div>
);
};
useHotkeysuseHotkeys(
keys: string | string[],
callback: (event: KeyboardEvent) => void,
options?: HotkeysOptions
): void
useHotkeysWithStateuseHotkeysWithState(
keys: string | string[],
callback: (event: KeyboardEvent) => void,
options?: HotkeysOptions & { returnState: true }
): HotkeyIndicatorState
HotkeysOptions)| Option | Type | Default | Description |
|---|---|---|---|
eventType | "keydown" | "keyup" | "keypress" | "keydown" | Which event to listen for |
target | EventTarget | null | window | DOM target for the event listener |
eventOptions | AddEventListenerOptions | boolean | false | Options for addEventListener |
enabled | boolean | true | Enable or disable the hotkey |
requireCtrl | boolean | false | Require the Control key |
requireMeta | boolean | false | Require the Meta key (â on Mac) |
requireShift | boolean | false | Require the Shift key |
requireAlt | boolean | false | Require the Alt key |
returnState | boolean | false | Whether to return state info (isActive, etc) |
HotkeyIndicatorState)| Property | Type | Description |
|---|---|---|
isActive | boolean | Whether the key is currently pressed |
lastKey | string? | Last key pressed |
lastEventType | string? | Last event type (keydown, keyup, keypress) |
pressCount | number | Total number of times triggered |
lastTriggeredAt | number? | Timestamp of last trigger |
isCombinationActive | boolean | Whether required modifiers are pressed |
The package also includes helpers for parsing and formatting hotkey patterns:
import {
matchHotkey,
matchAnyHotkey,
createHotkeyHandler,
formatPattern
} from "@luxonauta/use-hotkeys";
matchHotkey(event, pattern, options?): Check if an event matches a pattern like Control + K;matchAnyHotkey(event, [patterns], options?): Check against multiple patterns.createHotkeyHandler(patterns, handler, options?): Create an event handler for simple or sequence-based hotkeys.formatPattern(pattern, options?): Format a pattern for display:
formatPattern("Control+k"); // => "Ctrl + K"
formatPattern("g g"); // => "G then G"
import { createHotkeyHandler } from "@luxonauta/use-hotkeys";
export const Component = () => {
React.useEffect(() => {
const handler = createHotkeyHandler(
{ patterns: "g g", sequenceTimeoutMs: 600 },
() => {
console.log("Sequence G then G matched");
}
);
window.addEventListener("keydown", handler);
return () => window.removeEventListener("keydown", handler);
}, []);
return <p>Press "g g"</p>;
};
import { formatPattern } from "@luxonauta/use-hotkeys";
console.log(formatPattern("Control+k")); // Ctrl + K
console.log(formatPattern("Meta+Shift+p")); // ââ§P (on macOS)
target to bind hotkeys only inside a component;FAQs
đ A React hook for registering one or more keyboard shortcuts
The npm package @luxonauta/use-hotkeys receives a total of 0 weekly downloads. As such, @luxonauta/use-hotkeys popularity was classified as not popular.
We found that @luxonauta/use-hotkeys 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
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.