ilokesto

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

PropTypeDescription
combostring | "*"The key code to match.
onPress(event) => voidInvoked when the key is pressed.
enabledbooleanWhen false, the handler is not invoked.
event"keydown" | "keyup"Listener event. Defaults to keydown.
ignoreEditablebooleanIgnore events from editable elements.

On this page