Overview
ATextInput is a field that can be filled with text. It supports features like placeholders, password mode, text selection, clipboard operations, and input method editors (IMEs).
Constructor
text_input::TextInput::new
TextInput with the given placeholder and current value.
Parameters:
placeholder- Text shown when the input is emptyvalue- The current text content
Builder Methods
Identity
id
Security
secure
Event Handlers
on_input
on_input_maybe
None, the text input will be disabled.
on_submit
on_submit_maybe
on_paste
on_paste_maybe
Layout
width
Length::Fill.
padding
Text Styling
size
line_height
font
align_x
Icon
icon
Appearance
style
Status
Style
Examples
Basic Text Input
Password Input
With Submit Handler
Custom Width and Padding
With Icon
Validation with Conditional Enable
Disabled State
With Paste Handler
Keyboard Shortcuts
The text input supports standard keyboard shortcuts:- Ctrl+C / Cmd+C - Copy selected text
- Ctrl+X / Cmd+X - Cut selected text
- Ctrl+V / Cmd+V - Paste from clipboard
- Ctrl+A / Cmd+A - Select all text
- Arrow keys - Move cursor
- Shift+Arrow - Select text
- Ctrl+Arrow / Cmd+Arrow - Jump by words
- Home/End - Jump to start/end
- Backspace/Delete - Delete characters
State Management
The text input maintains internal state for:- Cursor position and selection
- Scroll offset (for text longer than the input)
- Focus state
- Input method editor (IME) state for complex character input
Related
Button
For form submission
Checkbox
For binary choices in forms
