gpui-kit GitHub

Components

CommandPalette view

A query field over a list of commands.

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

use gpui_kit::overlay::CommandPalette;

Construct

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

Options

Chain onto the value.

commands(commands: impl IntoIterator<Item = Command>) -> Self

Commands

Need a Context, so they need a view.

set_commands(commands: Vec<Command>, cx: &mut Context<Self>)
set_query(query: impl Into<SharedString>, cx: &mut Context<Self>)

Queries

Only answer; they change nothing.

query(cx: &App) -> SharedString
query_input() -> &Entity<TextInput>
focus_query(window: &mut Window, cx: &mut App)
active_id(cx: &App) -> Option<SharedString>

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/overlay/palette.rs