TextInput

Overview

Creates a text label or text input area for the user to provide a free-form value from the keyboard.

Ancestors

  1. Control
  2. Container
 

Descendants

  1. SelectInput
 

See Also

  1. None

Constructors

new TextInput
Description

Creates a new TextInput control.

Definition

new TextInput()

Members

alignment
Description

Gets or sets the alignment of the label or text input. The values that are allowed are left, right or center.

Definition

string textinput.alignment
enabled
Description

Gets or sets whether the control is editable. This causes the control to gray out and visual indicate its unable to take input or is disabled.

Definition

boolean textinput.enabled
font
Description

Gets or sets the font (family, size, weight, etc) of the text on the input or label.

Definition

Font textinput.font
linewrap
Description

Gets or sets whether the ENTER key creates a new line or when text reaches the end of the control it wraps to a new line. The default is false.

Definition

boolean textinput.linewrap
placeholder
Description

Gets or sets the text that is displayed in the text input or label prior to being modified by the user or programmatically. This is useful if you're collecting a field and want to use the area in the text input as an indicator of what value should be provided rather than create a seperate label. The default is an empty string.

Definition

string textinput.placeholder
readonly
Description

Gets or sets whether the control is read only or not. If true, the control is disabled as a label. If false, its disabled as a text input. The default is false.

Definition

boolean textinput.readonly
scrollable
Description

Gets or sets whether the text input has a visible scroll bar. If linewrap is set to false, the control does not display a scrollbar by default. The default is false.

Definition

boolean textinput.scrollable
textcolor
Description

Gets or sets the color of the text on the input or label.

Definition

Color textinput.textcolor
value
Description

Gets or sets the text as the value of the input or label.

Definition

string textinput.value
visible
Description

Gets or sets whether the control is visible on screen. The default is true.

Definition

boolean textinput.visible

Events

input
Description

Fires when the text has changed and new text is available. This is after the keydown event. This is useful if you'd not like to listen to keyup or keydown as those events may fire even if the value did not change (e.g., if the user changes the cursor selection with the arrow keys.)

Definition

textinput.addEventListener('input', function() { ... });
inputend
Description

Fires when the user has finished inputting text. This is determined by when the user presses return when linewrap = false (e.g., the text input only takes a single line of text), or when the control looses focus or another event prevents input. This event is useful to listen to if you need to take an action AFTER a user has fully inputted all the text, for example the URL input field on a browser, only until the user is fully done typing should we try and load the URL.

Definition

textinput.addEventListener('inputend', function() { ... });
inputstart
Description

Fires when the user begins inputting text prior to keyup, keydown or input. This event is useful if an animation or other event should fire when the user first types, but not on every key afterwards. For example, you might listen to this event to show some sort of in-context dialog or menu while the user is typing (like an auto-fill menu).

Definition

textinput.addEventListener('inputstart', function() { ... });