TextInput view
One line of editable text.
A view survives a frame. Hold it in an Entity with cx.new(..) and reach it with .update(..).
use gpui_kit::controls::TextInput;
Construct
new(ident: impl Into<Ident>, window: &mut Window, cx: &mut Context<Self>) -> SelfOptions
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
secret(secret: bool) -> Self
bare(bare: bool) -> Self
max_length(max_length: usize) -> SelfCommands
Need a Context, so they need a view.
set_name(name: impl Into<SharedString>, cx: &mut Context<Self>)
set_value(value: impl Into<SharedString>, cx: &mut Context<Self>)
set_placeholder(placeholder: impl Into<SharedString>, cx: &mut Context<Self>)
set_text_quietly(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
is_secret() -> bool
selected_range() -> Range<usize>
cursor_offset() -> usizeReports
The variants of the event it emits. It never applies the change itself.
- Change
- Submit
- Cancel
- BackspaceAtStart
- Focus
- Blur
Rendered by
Each of these compiles and is captured by the gate, so the code behind them is verified rather than written.