Select view
A closed list of options with one answer.
A view survives a frame. Hold it in an Entity with cx.new(..) and reach it with .update(..).
use gpui_kit::controls::Select;
Construct
new(ident: impl Into<Ident>, _window: &mut Window, cx: &mut Context<Self>) -> SelfOptions
Chain onto the value.
options(options: impl IntoIterator<Item = SelectOption>) -> Self
selected(id: impl Into<SharedString>) -> Self
placeholder(placeholder: impl Into<SharedString>) -> Self
invalid(invalid: bool) -> SelfCommands
Need a Context, so they need a view.
set_options(options: Vec<SelectOption>, cx: &mut Context<Self>)
set_selected(id: Option<SharedString>, cx: &mut Context<Self>)
set_disabled(disabled: bool, cx: &mut Context<Self>)Queries
Only answer; they change nothing.
selected_id() -> Option<&SharedString>
selected_option() -> Option<&SelectOption>
is_open() -> boolReports
The variants of the event it emits. It never applies the change itself.
- Selected
- Opened
- Closed
Rendered by
Each of these compiles and is captured by the gate, so the code behind them is verified rather than written.