Global hot keys are hot keys that are not associated with any scope. They will be triggered if the active scope does not handle the hot key. In this page, we will guide you how to register global hot keys.
useGlobalHotKeysRegister global hot keys with Ez Hot Keys is very simple. Just use useGlobalHotKeys hook to register global hot keys.
import { useGlobalHotKeys } from "@ez-kits/hot-keys-react";
function MyComponent() {
useGlobalHotKeys({
hotKeys: {
"ctrl+k": () => {
console.log("ctrl+k is pressed");
},
},
});
return <div>Register global hot keys</div>;
}