-
Notifications
You must be signed in to change notification settings - Fork 9
Component Select
MeowLynxSea edited this page Feb 14, 2026
·
8 revisions
A non-editable dropdown.
Select is the lightweight dropdown for small option sets.
use gpui::ElementId;
use yororen_ui::component::{select, select_option};
let region = select()
.key(ElementId::from((ElementId::from("settings"), "region")))
.placeholder("Region")
.options([
select_option().value("us").label("US"),
select_option().value("eu").label("EU"),
])
.on_change(|value, _window, _cx| {
// ...
});- Small option sets where search is unnecessary
Not a good fit:
- Large option sets (use
ComboBox)
-
select(): constructor -
id(...) / key(...): stable identity -
options([...])/option(SelectOption) -
select_option()+.value("...").label("...")+.disabled(true) -
value(String): set selected value (controlled) placeholder("...")-
localized(): use i18n placeholder (see Internationalization) disabled(bool)-
menu_width(px(...)): explicit menu width -
on_change(|value, window, cx| ...): change handler with window and app context -
on_change_simple(|value| ...): simplified handler that only receives the value -
on_change_with_event(|value, ev, window, cx| ...): handler with click event - Styling:
bg/border/focus_border/text_color/height
- Menu open state is internal (
ui:select:open). - Clicking outside closes the menu.
- Height:
36px - Placeholder:
"Select…" - If you omit
on_change,on_change_simple, andvalue, Select owns an internal selected value.
- For large option sets or when users need search, use
ComboBox.
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.