TextFieldView
A flexible text input field view with support for various input types and validation.
This class extends BaseTextFieldView to provide a complete text field implementation with support for different input types (text, numeric, file/directory dialogs), styling options, placeholder text, and various layout configurations.
Features
- Multiple input types: TEXT, NUMERIC, DIR, FILE
- Placeholder text support
- Multiline text editing
- Text alignment options
- Disabled state handling
- Theme-based styling
- Dialog integration for file/directory selection (when plugin_dialogs is available)
Input Types
TEXT
: Standard text inputNUMERIC
: Numeric input with validationDIR
: Directory picker (requires plugin_dialogs)FILE
: File picker (requires plugin_dialogs)
Usage Examples
// Create a basic text field
var textField = new TextFieldView(TEXT);
textField.placeholder = "Enter your name";
textField.textAlign = CENTER;
// Create a numeric field
var numericField = new TextFieldView(NUMERIC);
numericField.placeholder = "Enter a number";
// Create a multiline text area
var textArea = new TextFieldView(TEXT);
textArea.multiline = true;
textArea.placeholder = "Enter description";
#if plugin_dialogs
// Create a directory picker
var dirField = new TextFieldView(DIR("Select Project Directory"));
// Create a file picker
var fileField = new TextFieldView(FILE("Select Image", [
{ name: "Images", extensions: ["png", "jpg", "gif"] }
]));
#end
Instance Members
The theme used for styling this text field. If null, the context's default theme will be used.
Whether this text field supports multiline text input. When true, the text field will accept and display multiple lines of text.
@default false
The placeholder text displayed when the field is empty. This text provides a hint to the user about what to enter.
The visual style of the input field. Controls the appearance and rendering style of the text field.
The text alignment within the field. Controls how text is aligned horizontally within the input area.
Whether the text field is disabled. When disabled, the field cannot be edited or interacted with.
The type of text field, determining its input behavior. This is set during construction and cannot be changed afterward.
Focuses the text field, making it ready for text input. If the field is disabled, this method has no effect.
Creates a new text field view.
Name | Type | Default | Description |
---|---|---|---|
kind |
Anonymous | TEXT |
The type of text field to create (TEXT, NUMERIC, DIR, FILE) |
Private Members
The layers layout container for organizing visual elements. @private
The text view used to display the placeholder text. @private
Event when theme field changes.
Name | Type |
---|---|
current |
Theme |
previous |
Theme |
Event when placeholder field changes.
Name | Type |
---|---|
current |
String |
previous |
String |
Event when inputStyle field changes.
Name | Type |
---|---|
current |
Anonymous |
previous |
Anonymous |
Event when textAlign field changes.
Name | Type |
---|---|
current |
Anonymous |
previous |
Anonymous |
Event when disabled field changes.
Name | Type |
---|---|
current |
Bool |
previous |
Bool |
Clips the text to fit within the specified dimensions.
@private
Name | Type | Description |
---|---|---|
width |
Float | The width to clip to |
height |
Float | The height to clip to |
Handles when text editing stops. Releases focus if there are no active suggestions. @private
Updates the placeholder display based on current state. The placeholder is shown when the field is empty and either unfocused or disabled. @private
Updates the visual style of the text field based on the current theme and state. Applies different styling for OVERLAY vs DEFAULT input styles, and handles disabled and focused states. @private
Metadata
Name | Parameters |
---|---|
:build |
tracker.macros.ObservableMacro.build() |
:autoBuild |
tracker.macros.ObservableMacro.build() |
:build |
tracker.macros.EventsMacro.build() |
:autoBuild |
tracker.macros.EventsMacro.build() |
:build |
ceramic.macros.EntityMacro.buildForCompletion() |
:autoBuild |
ceramic.macros.EntityMacro.buildForCompletion() |