GPUI Box GitHub

Components

PasswordInput view

One sensitive password editor with a visual reveal action.

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

use gpui_kit::controls::PasswordInput;

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
name(name: impl Into<SharedString>) -> Self
text(text: impl Into<SharedString>) -> Self
invalid(invalid: bool) -> Self
required(required: bool) -> Self
read_only(read_only: bool) -> Self

Commands

Need a Context, so they need a view.

set_value(value: impl Into<SharedString>, cx: &mut Context<Self>)
set_disabled(disabled: bool, cx: &mut Context<Self>)
set_read_only(read_only: bool, cx: &mut Context<Self>)
set_invalid(invalid: bool, cx: &mut Context<Self>)

Queries

Only answer; they change nothing.

value(cx: &App) -> SharedString
is_revealed() -> bool
selected_range(cx: &App) -> Range<usize>

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