-
Notifications
You must be signed in to change notification settings - Fork 9
Component SearchInput
MeowLynxSea edited this page Jan 24, 2026
·
5 revisions
A standardized search input (magnifier + clear button + submit).
SearchInput is a convenience wrapper over TextInput that provides:
- A leading magnifier icon
- An inline clear button when there is content
-
on_submitfor “press Enter to search”
use gpui::ElementId;
use yororen_ui::component::search_input;
let view = search_input()
.key(("search", "query"))
.placeholder("Search…")
.on_change(|value, _window, _cx| {
// ...
})
.on_submit(|value, _window, _cx| {
// ...
});- Search bars
- Filtering inputs where the clear button improves UX
Guide-Recipes-VirtualList-Search
-
search_input(): constructor -
id(...) / key(...): stable identity placeholder("...")disabled(bool)on_change(|value, window, cx| ...)on_submit(|value, window, cx| ...)- Styling:
bg/border/focus_border/text_color/height
- Internally it owns a
TextInputStateso the clear button can reset the content.
- Height:
36px - Leading icon:
IconName::Search - Clear button appears when there is content and the input is not disabled
- The clear button resets the internal
TextInputStatecontent to an empty string and callson_change("", ...)if provided.
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.