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 input
  • NUMERIC: Numeric input with validation
  • DIR: 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

elements
theme: Theme

The theme used for styling this text field. If null, the context's default theme will be used.


elements
multiline: Bool

Whether this text field supports multiline text input. When true, the text field will accept and display multiple lines of text.

@default false


elements
placeholder: String

The placeholder text displayed when the field is empty. This text provides a hint to the user about what to enter.


elements
inputStyle: Anonymous

The visual style of the input field. Controls the appearance and rendering style of the text field.


elements
textAlign: Anonymous

The text alignment within the field. Controls how text is aligned horizontally within the input area.


elements
disabled: Bool

Whether the text field is disabled. When disabled, the field cannot be edited or interacted with.


elements
kind: Anonymous

The type of text field, determining its input behavior. This is set during construction and cannot be changed afterward.


elements
invalidateTheme(): Void

elements
invalidatePlaceholder(): Void

elements
invalidateInputStyle(): Void

elements
invalidateTextAlign(): Void

elements
invalidateDisabled(): Void

elements
focus(): Void

Focuses the text field, making it ready for text input. If the field is disabled, this method has no effect.


elements
new(?kind: Anonymous = TEXT): Void

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

elements
unobservedTheme: Theme

elements
unobservedPlaceholder: String

elements
unobservedInputStyle: Anonymous

elements
unobservedTextAlign: Anonymous

elements
unobservedDisabled: Bool

elements
layers: ceramic.LayersLayout

The layers layout container for organizing visual elements. @private


elements
placeholderView: ceramic.TextView

The text view used to display the placeholder text. @private


elements
emitThemeChange(current: Theme, previous: Theme): Void

Event when theme field changes.

Name Type
current Theme
previous Theme

elements
didLostFocus(): Void

elements
emitPlaceholderChange(current: String, previous: String): Void

Event when placeholder field changes.

Name Type
current String
previous String

elements
emitInputStyleChange(current: Anonymous, previous: Anonymous): Void

Event when inputStyle field changes.

Name Type
current Anonymous
previous Anonymous

elements
emitTextAlignChange(current: Anonymous, previous: Anonymous): Void

Event when textAlign field changes.

Name Type
current Anonymous
previous Anonymous

elements
emitDisabledChange(current: Bool, previous: Bool): Void

Event when disabled field changes.

Name Type
current Bool
previous Bool

elements
layout(): Void

elements
clipText(width: Float, height: Float): Void

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

elements
handleStopEditText(): Void

Handles when text editing stops. Releases focus if there are no active suggestions. @private


elements
updatePlaceholder(): Void

Updates the placeholder display based on current state. The placeholder is shown when the field is empty and either unfocused or disabled. @private


elements
updateStyle(): Void

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()