-
Notifications
You must be signed in to change notification settings - Fork 9
Component KeybindingInput
MeowLynxSea edited this page Jun 13, 2026
·
5 revisions
A single-line text input that, when in Capturing mode, records the next keystroke as a keybinding combo instead of typing it. Used for "press a key to bind" settings rows.
use yororen_ui::headless::keybinding_input::keybinding_input;
use yororen_ui::headless::keybinding_input::KeybindingInputMode;use yororen_ui::headless::keybinding_input::{keybinding_input, KeybindingInputMode};
keybinding_input("bind-save")
.placeholder("Press a key combo…")
.mode(KeybindingInputMode::Idle)
.on_start_capture(|_window, _cx| {
// switch the input into capture mode
})
.on_change({
let entity = cx.entity();
move |new: &str, _window, cx| {
entity.update(cx, |s, _cx| s.binding = new.to_string());
}
})
.render(cx, window)| Method | Purpose |
|---|---|
mode(m) |
KeybindingInputMode::Idle (default) or KeybindingInputMode::Capturing. |
placeholder(text) |
Hint text shown when empty. |
disabled(v) |
Disable interaction. |
on_change(closure) |
Fn(&str, &mut Window, &mut App) + 'static + Send + Sync. Fired with the captured combo as a string. |
on_start_capture(closure) |
Fn(&mut Window, &mut App) + 'static + Send + Sync. The input is now capturing. |
on_cancel_capture(closure) |
Fn(&mut Window, &mut App) + 'static + Send + Sync. The user dismissed capture (e.g. pressed Escape). |
- Factory takes
(id)only. Like the other text-style inputs, the focus handle and the keyed state are minted by the renderer. -
.render(cx, window)is two-arg and returnsAnyElement. Thewindowis required because the renderer hooks theEntityInputHandlerfor IME / paste. - The mode enum is
KeybindingInputMode(notKeybindingMode); it has two variants:Idle(default) andCapturing. There is noChordvariant. -
on_changeandon_start_captureare typically called from a parent view that flipsmode(...)betweenIdleandCapturingin response.
TextInput, ShortcutHint, SearchInput
Yororen UI v0.3.0 · repository · Apache-2.0 · This wiki documents Yororen UI v0.3.0.
This wiki documents Yororen UI v0.3.0 — the headless-core, swappable-renderer build.