Class: TextInputField

TextInputField()

new TextInputField()

An interactive UI element for text input from the keyboard.
Source:

Extends

  • BaseUIElement

TextInputField(options)

new TextInputField(options)

Creates an instance of TextInputField.
Parameters:
Name Type Description
options object Configuration options.
Properties
Name Type Attributes Default Description
x number <optional>
0 The x-coordinate.
y number <optional>
0 The y-coordinate.
width number <optional>
200 The width of the input field.
height number <optional>
30 The height of the input field.
initialText string <optional>
'' Initial text content.
placeholderText string <optional>
'' Text to display when the field is empty and not focused.
maxLength number <optional>
null Maximum number of characters. Null for no limit.
font string <optional>
'16px sans-serif' Font for the text.
textColor string <optional>
'black' Color of the text.
placeholderColor string <optional>
'gray' Color of the placeholder text.
backgroundColor string <optional>
'white' Background color of the field.
borderColor string <optional>
'gray' Border color.
focusBorderColor string <optional>
'dodgerblue' Border color when focused.
borderWidth number <optional>
1 Width of the border.
padding number <optional>
5 Inner padding for text.
onEnterPressed function <optional>
Callback when Enter is pressed. Receives current text.
onTextChanged function <optional>
Callback when text changes. Receives new text.
onFocus function <optional>
Callback when the field gains focus.
onBlur function <optional>
Callback when the field loses focus.
Source: