TextInput
Base single-line text input with selection, caret navigation, clipboard integration, and reactive focus chrome.
Overview
TextInput extends Box to provide single-line editable text input backed by TextEditorModel. It features smooth caret blinking, mouse drag/click selection, double-click word selection, clipboard copy/cut/paste, max length limits, and placeholder text.
Input chrome dynamically updates between normal, hovered, and focused states with dedicated border and ring colors.
Username Input
TextInput username = new TextInput()
.placeholder("Enter username...")
.maxLength(24);
username.onTextChanged(e -> validateUser(e.newText()));
Related links
API
TextInput()
Constructor
Creates an empty TextInput.
TextInput::onTextChanged(EventListener)
On Text Changed Listener
Registers a callback invoked whenever the text content changes.
| Parameter | Type | Description |
|---|---|---|
listener |
EventListener |
— |
Returns EventSubscription.