-
Notifications
You must be signed in to change notification settings - Fork 9
Component FilePathInput
MeowLynxSea edited this page Feb 13, 2026
·
6 revisions
A file/folder path selector.
This control is read-only: users choose a path via the "Choose..." button.
FilePathInput always owns internal value state so it can immediately reflect the chosen path.
You can still observe changes via on_change.
use gpui::ElementId;
use yororen_ui::component::{file_path_input, FilePathStatus};
let view = file_path_input()
.key(ElementId::from(("settings", "workspace_path")))
.placeholder("/path/to/folder")
.status(FilePathStatus::Ok)
.on_change(|path, _window, _cx| {
// path: PathBuf
});- Settings screens where users choose a directory or executable
- Anything that should use the OS path picker instead of free-form typing
Not a good fit:
- Free-form path editing (use
TextInput)
-
file_path_input(): constructor -
id(...) / key(...): stable identity -
value(PathBuf): initial value placeholder("...")-
localized(): use i18n placeholder (see Internationalization) disabled(bool)-
status(FilePathStatus):-
Ok/Warning/Error
-
-
on_change(|path, window, cx| ...): fired when a new path is picked - Styling:
bg/border/focus_border/text_color/height
- Clicking the button prompts for a single file or directory.
- If
status(...)is not set:- empty value: no status
- non-empty value: treated as
Ok
- The button label in the UI is localized (currently
"选择…").
- Height:
36px - Placeholder:
"选择路径…" - Value state: always internal (updates immediately after picking)
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.