-
Notifications
You must be signed in to change notification settings - Fork 9
Component FilePathInput
MeowLynxSea edited this page Jun 13, 2026
·
6 revisions
A text input specialised for file paths. Has a leading folder icon and a trailing "Browse" button. Clicking Browse fires on_browse — typically the caller opens a native file picker and writes the picked path back via on_change.
use yororen_ui::headless::file_path_input::file_path_input;use yororen_ui::headless::file_path_input::file_path_input;
file_path_input("config-path")
.placeholder("/path/to/config.toml")
.value(self.config_path.clone())
.on_change({
let entity = cx.entity();
move |new: &str, _window, cx| {
entity.update(cx, |s, _cx| s.config_path = new.to_string());
}
})
.on_browse(|_picked: &str, _window, _cx| {
// Renderer has already written the picked path into the input's
// state and fired `on_change`; this hook is for caller extras.
})
.render(cx, window)| Method | Purpose |
|---|---|
placeholder(text) |
Hint shown when empty. |
value(s) |
Current value (String-like). |
disabled(v) |
Disable interaction (and the Browse button). |
on_change(closure) |
Fn(&str, &mut Window, &mut App) + 'static + Send + Sync. |
on_browse(closure) |
Fn(&str, &mut Window, &mut App) + 'static + Send + Sync. The Browse button was clicked. The argument is the current value. |
has_custom_bg(v) / custom_bg(hsla)
|
Override the background. |
has_custom_border(v) / custom_border(hsla)
|
Override the border. |
has_custom_focus_border(v) / custom_focus_border(hsla)
|
Override the focus border. |
custom_text_color(hsla) |
Override the text color. |
-
Factory takes
(id)only — nocxargument. -
.render(cx, window)is two-arg and returnsAnyElement. Thewindowis required for IME / paste. - The headless layer does not open a file picker — it only fires
on_browse. The caller is expected to use gpui'sWindow::open_file_dialog(or platform equivalent) and write the result back through the input's state. - The state is minted internally by the renderer.
TextInput, SearchInput, PasswordInput
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.