GPUI Box GitHub

Components

Cascader view

A menu of progressively revealed caller-owned option columns.

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

use gpui_kit::controls::Cascader;

Construct

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

Options

Chain onto the value.

options(options: impl IntoIterator<Item = CascaderOption>) -> Self
selected(id: impl Into<SharedString>) -> Self
name(name: impl Into<SharedString>) -> Self
placeholder(placeholder: impl Into<SharedString>) -> Self

Commands

Need a Context, so they need a view.

set_options(options: Vec<CascaderOption>, cx: &mut Context<Self>)
set_selected(selected: Option<SharedString>, cx: &mut Context<Self>)
set_name(name: impl Into<SharedString>, cx: &mut Context<Self>)
set_placeholder(placeholder: Option<SharedString>, cx: &mut Context<Self>)
set_disabled(disabled: bool, cx: &mut Context<Self>)
open(window: &mut Window, cx: &mut Context<Self>)
close(cx: &mut Context<Self>)

Queries

Only answer; they change nothing.

selected_id() -> Option<&SharedString>
is_open() -> bool
open_path() -> &[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/controls/cascader.rs