Skip to content

Keybind

function Keybind(__namedParameters): null;

Declarative keyboard shortcut handler (renders nothing).

Add <Keybind> anywhere in your tree to react to specific key combinations. Supports modifier keys (ctrl, alt, shift, meta) and a priority flag to run before focused input handlers.

ParameterType
__namedParametersKeybindProps

null

// Global quit shortcut
<Keybind keypress="ctrl+q" onPress={() => exit()} />
// Priority keybind that fires even when an Input is focused
<Keybind keypress="ctrl+enter" onPress={submit} priority />
// Only fires when a specific element is focused
<Keybind keypress="delete" onPress={handleDelete} whenFocused={itemFocusId} />

PropertyTypeDescription
disabled?booleanDisabled state
global?booleanOnly fire when nothing is focused or the focused element doesn’t consume the key
keypressstringKey descriptor, e.g. “q”, “escape”, “ctrl+c”, “ctrl+shift+a”
onPress() => voidHandler called when the key matches
priority?booleanIf true, this keybind runs BEFORE focused input handlers. Use for keybinds that should work even when an Input is focused (e.g., Ctrl+Enter to submit).
whenFocused?stringOnly fire when this focus ID is active