gpui-kit GitHub

Components

SearchField view

A query field, a hit count, and next and previous.

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

use gpui_kit::controls::SearchField;

Construct

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

Options

Chain onto the value.

placeholder(placeholder: impl Into<SharedString>) -> Self
match_case(on: bool) -> Self
whole_word(on: bool) -> Self

Commands

Need a Context, so they need a view.

set_count(count: HitCount, cx: &mut Context<Self>)
set_query(text: impl Into<SharedString>, cx: &mut Context<Self>)
set_disabled(disabled: bool, cx: &mut Context<Self>)

Queries

Only answer; they change nothing.

count() -> &HitCount
query_text(cx: &App) -> SharedString
query_input() -> &Entity<TextInput>
focus(window: &mut Window, cx: &mut Context<Self>)

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/search.rs