Hotkey
Hotkey declares a keyboard hotkey and renders nothing. combo is a KeyboardEvent.code value (e.g. "Escape", "KeyS") or "*" for any key.
import { Hotkey } from '@ilokesto/utilinent';
<Hotkey combo="Escape" onPress={() => close()} />
<Hotkey combo="KeyS" onPress={save} ignoreEditable />Props
| Prop | Type | Description |
|---|---|---|
combo | string | "*" | The key code to match. |
onPress | (event) => void | Invoked when the key is pressed. |
enabled | boolean | When false, the handler is not invoked. |
event | "keydown" | "keyup" | Listener event. Defaults to keydown. |
ignoreEditable | boolean | Ignore events from editable elements. |