Skip to content

Class: InputFieldComponent ​

An editable text box (Cocos's EditBox, Unity's InputField). The host is the box: a UITransform for its rect, usually a background Sprite. Two Text entities show it — textLabel gets the value (masked for Password / Pin), placeholderLabel shows while it's empty.

A tap focuses it. While editing, InputFieldSystem lays a real DOM <input> / <textarea> over the text label, styled like it, and hides both labels — that's what brings up mobile keyboards and gives IME, paste and selection for free. Enter submits (single line), Esc restores the text it had on focus, and a tap anywhere else ends the edit.

Events on the host: EntityEvent.InputFocus, InputChanged (each keystroke), InputSubmit (Enter), InputEndEdit (focus lost, any reason). Payload: the text.

Extends ​

Constructors ​

Constructor ​

ts
new InputFieldComponent(): InputFieldComponent;

Returns ​

InputFieldComponent

Inherited from ​

Component.constructor

Properties ​

PropertyModifierTypeDefault valueDescriptionInherited from
characterLimitpublicnumberundefined0 = no limit.-
contentTypepublicInputContentTypeundefined--
dirtypublicbooleantrue-Component.dirty
enabledpublicbooleantrue-Component.enabled
interactablepublicbooleanundefined--
multilinepublicbooleanundefined--
placeholderpublicstringundefined--
placeholderLabelpublicnumber | nullundefined--
returnKeypublicInputReturnKeyundefined--
textpublicstringundefined--
textLabelpublicnumber | nullundefined--

Accessors ​

isFocused ​

Get Signature ​

ts
get isFocused(): boolean;
Returns ​

boolean

Methods ​

Blur() ​

ts
Blur(): void;

Returns ​

void


Focus() ​

ts
Focus(): void;

Takes effect on the next rendered frame. Focus only brings up a mobile keyboard when it's called from a user gesture (a tap handler).

Returns ​

void


SetPlaceholderLabel() ​

ts
SetPlaceholderLabel(target): void;

Parameters ​

ParameterType
targetnumber | Entity | null

Returns ​

void


SetTextLabel() ​

ts
SetTextLabel(target): void;

Entity wrapper or raw id — stored as an id, like ScrollViewComponent.SetContent.

Parameters ​

ParameterType
targetnumber | Entity | null

Returns ​

void

© 2026 PlayAdGentic