Type String
Object TextField
Library native.*
Revision Release 2024.3703
Keywords native text input
See also native.newTextField()


Native text fields can display optional placeholder text (nil by default). This can provide a "hint" as to what the user should enter in the field. If set, the placeholder string is displayed using the same style information (except the text color). The placeholder does not appear once actual text has been input into the field and it does not currently participate in determining the size of the text field.


local numericField = native.newTextField( 150, 150, 220, 36 )
numericField.inputType = "number"

-- Optional placeholder (hint) for the text field
numericField.placeholder = "(phone number)"

numericField:addEventListener( "userInput", handlerFunction )