Overview
TextComponent is a form input component that creates an <input> element for single-line text entry. It extends AbstractTextComponent<HTMLInputElement> and provides a fluent API for configuring text inputs.
Constructor
The parent HTML element where the text input will be created
Properties
Direct access to the underlying HTML input element. Use this for advanced DOM manipulation.
Whether the component is currently disabled
Methods
setValue
Sets the current value of the text input.The text value to set
this (for method chaining)
getValue
Retrieves the current value of the text input.string - The current text value
setPlaceholder
Sets placeholder text that appears when the input is empty.The placeholder text to display
this (for method chaining)
setDisabled
Enables or disables the text input.Whether the component should be disabled
this (for method chaining)
onChange
Registers a callback function that executes whenever the text value changes.Function to call when the value changes. Receives the new value as a parameter.
this (for method chaining)
onChanged
Internal method called when the value changes. Override this in subclasses for custom behavior.then
Facilitates method chaining with a callback.Callback function that receives the component instance
this (for method chaining)
Usage Examples
Basic Text Input
Email Input with Validation
Disabled Text Input
Direct DOM Access
See Also
- TextAreaComponent - For multi-line text input
- Setting - Container for form components in settings
- Button Component - For adding action buttons