gpui-kit GitHub

Components

Combobox view

A [`Select`](crate::controls::select::Select) you can type into.

A view survives a frame. Hold it in an Entity with cx.new(..) and reach it with .update(..).

use gpui_kit::controls::Combobox;

Construct

new(ident: impl Into<Ident>, window: &mut Window, cx: &mut Context<Self>) -> Self

Options

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) -> Self
allow_custom(allow_custom: bool) -> Self

Commands

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_query(text: impl Into<SharedString>, cx: &mut Context<Self>)
set_disabled(disabled: bool, cx: &mut Context<Self>)
open(cx: &mut Context<Self>)
toggle(window: &mut Window, cx: &mut Context<Self>)

Queries

Only answer; they change nothing.

selected_id() -> Option<&SharedString>
selected_option() -> Option<&SelectOption>
is_open() -> bool
query_text(cx: &App) -> SharedString
query_input() -> &Entity<TextInput>

Reports

The variants of the event it emits. It never applies the change itself.

Rendered by

Each of these compiles and is captured by the gate, so the code behind them is verified rather than written.

Source: crates/gpui-kit/src/controls/combobox.rs