gpui-kit GitHub

Components

Switch builder

A control that takes effect the moment it is flipped.

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

use gpui_kit::controls::Switch;

Construct

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

Options

Chain onto the value.

label(label: impl Into<SharedString>) -> Self
description(description: impl Into<SharedString>) -> Self
named(name: impl Into<SharedString>) -> Self
on(on: bool) -> Self
on_change(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.rs