Skip to content

TextField

A TextField is a rectangular area in which people enter or edit small, specific pieces of text.

Component preview

Summary

Properties

Property Type Description
Placeholder string? The text placeholder to instruct users on how to interact with the component.
Value Enum.Keycode? The text in the field.

View all inherited from BaseComponent

View all inherited from Frame

Methods

View all inherited from Frame

Events

Event Signature Description
TextChanged ((self: TextField, text: string) -> unknown)? A Callback function that is triggered when the text field's text has been modified.
ValueChanged ((self: TextField, value: string) -> unknown)? A Callback function that is triggered when the Value property has been modified.

View all inherited from Frame

Types

type TextFieldProperties = Frame & {
    Placeholder: string?,
    Value: string?,
    TextChanged: ((self: TextField, text: string) -> unknown)?,
    ValueChanged: ((self: TextField, value: string) -> unknown)?,
}

type TextField = BaseComponent & Components & TextFieldProperties

Function Signature

function(self, properties: TextFieldProperties): TextField

Example

local textField = row:Right():TextField({
    Value = "Label",
    ValueChanged = function(self, value: string)
        print("Value changed:", value)
    end,
    TextChanged = function(self, value: string)
        print("Text changed:", value)
    end,
})

print(textField:IsA("Frame")) --> true
print(textField.ClassName) --> "Frame"
print(textField.Type) --> "TextField"

textField.Value = "Hi" --> Value changed: "Hi"