gpui-kit GitHub

Components

Toggle builder

A button that stays in.

A builder is RenderOnce. Construct and mount it in one expression.

use gpui_kit::controls::Toggle;

Construct

new(ident: impl Into<Ident>) -> Self

Options

Chain onto the value.

label(label: impl Into<SharedString>) -> Self
accessible_name(name: impl Into<SharedString>) -> Self
icon(glyph: Icon) -> Self
icon_only(glyph: Icon, name: impl Into<SharedString>) -> Self
pressed(pressed: bool) -> Self
variant(variant: ButtonVariant) -> Self
secondary() -> Self
ghost() -> Self
join(join: ButtonJoin) -> Self
semantic_parent(parent: impl Into<SharedString>) -> Self
track_focus(handle: &FocusHandle) -> Self
on_press(handler: impl Fn(bool, &mut Window, &mut App) + 'static) -> Self

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