Skip to content

TextInputProperties

export type TextInputProperties = {
    Enabled: CanBeState<boolean>?,
    Text: CanBeValue<string>?,
    OnChange: (newText: string) -> nil,
    OnFocusLost: ((newText: string) -> nil)?,
    Filter: ((newText: string) -> boolean)?,
    [any]: any,
}

The TextInputProperties table that is given to the TextInput() function that contains data about the desired TextInput.


Properties

Enabled : CanBeState<boolean>?

Sets whether the TextInput will be enabled or not. Can either be a State containing a boolean, or a boolean.


Text : CanBeValue<string>?,

The default text that will be displayed on the TextInput. Can either be a Value containing a string, or a string. This property can be changed by the end-user.


OnChange : (newText: string) -> nil,

The callback function that will be called when the Text property changes.


OnFocusLost : ((newText: string) -> nil)?,

The callback function that will be called when the focus has been lost on the TextInput, when Enter has been pressed. If the Filter callback function has been set, then this function will only be called after Filter callback function returns true.


Filter : ((newText: string) -> boolean)?,

The callback function that will be called when the focus has been lost on the TextInput, when Enter has been pressed. This function is called first if defined, and allows you to filter the incoming text on the TextInput.

If this function returns true, then the text will be deemed filtered, and the OnFocusLost callback function will be called, if it exists. And the Text property of the TextInput will be set to the newText.

If this function returns false, then the Text property will automatically be reverted to its previous state.