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
Properties
| Property | Modifier | Type | Default value | Description | Inherited from |
|---|---|---|---|---|---|
characterLimit | public | number | undefined | 0 = no limit. | - |
contentType | public | InputContentType | undefined | - | - |
dirty | public | boolean | true | - | Component.dirty |
enabled | public | boolean | true | - | Component.enabled |
interactable | public | boolean | undefined | - | - |
multiline | public | boolean | undefined | - | - |
placeholder | public | string | undefined | - | - |
placeholderLabel | public | number | null | undefined | - | - |
returnKey | public | InputReturnKey | undefined | - | - |
text | public | string | undefined | - | - |
textLabel | public | number | null | undefined | - | - |
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
| Parameter | Type |
|---|---|
target | number | Entity | null |
Returns
void
SetTextLabel()
ts
SetTextLabel(target): void;Entity wrapper or raw id — stored as an id, like ScrollViewComponent.SetContent.
Parameters
| Parameter | Type |
|---|---|
target | number | Entity | null |
Returns
void