gpui-kit GitHub

Components

TextArea view

Wrapped, multi-line editable text.

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

use gpui_kit::controls::TextArea;

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
text(text: impl Into<SharedString>) -> Self
invalid(invalid: bool) -> Self
required(required: bool) -> Self
rows(rows: usize) -> Self
max_rows(max_rows: usize) -> Self
max_length(max_length: usize) -> 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_invalid(invalid: bool, cx: &mut Context<Self>)

Queries

Only answer; they change nothing.

value() -> &SharedString
is_empty() -> bool
is_disabled() -> bool
selected_range() -> Range<usize>
cursor_offset() -> usize
cursor_row() -> 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/textarea/mod.rs