Triggers a callback when the Escape key is pressed.
The function to call when Escape is pressed.
This hook subscribes to the global keyup$ observable and filters for the "Escape" key. Useful for closing modals, tooltips, or cancelling actions.
keyup$
useOnEscape(() => { setIsOpen(false);}); Copy
useOnEscape(() => { setIsOpen(false);});
Triggers a callback when the Escape key is pressed.