Skip to main content

UITextInput

Inherits from UIView

UITextInput is a class that allows the user to enter text.


Summary

Properties

Methods

Events


Properties

AutoSize

UITextInput.AutoSize: bool

Whether the text should be automatically sized to fit the label's size.

Example

element.AutoSize = true

Font

UITextInput.Font: TextFontPreset

The font of the label.

Example

element.Font = TextFontPreset.Montserrat

FontSize

UITextInput.FontSize: float

The font size of the label.

Example

element.FontSize = 20

IsMultiline

UITextInput.IsMultiline: bool

Set if the text input can be multiline.

Example

element.IsMultiline = true

IsReadOnly

UITextInput.IsReadOnly: bool

Set if the text input can be edited or not.

Example

element.IsReadOnly = true

JustifyText

UITextInput.JustifyText: TextJustify

Determines how the text is justified.

Example

element.JustifyText = TextJustify.Center

MaxFontSize

UITextInput.MaxFontSize: float

The maximum font size of the UI element if AutoSize is set to true.

Example

element.MaxFontSize = 16

Placeholder

UITextInput.Placeholder: string

The placeholder of the text input.

Example

element.Placeholder = "Type here..."

PlaceholderColor

UITextInput.PlaceholderColor: Color

The color of the placeholder text.

Example

element.PlaceholderColor = Color.New(0, 0, 0, 0.5)

Text

UITextInput.Text: string

The text of the label.

Example

element.Text = "Hello, World!"

TextColor

UITextInput.TextColor: Color

The color of the text.

Example

element.TextColor = Color.New(0, 0, 0, 1)

VerticalAlign

UITextInput.VerticalAlign: TextVerticalAlign

The vertical alignment of the text.

Example

element.VerticalAlign = TextVerticalAlign.Middle

Methods

Focus

UITextInput:Focus()

Forces the local player to focus on the text input.

-- Focuses on the ExampleTextField
game["PlayerGUI"]["ExampleTextField"]:Focus()

Events


Events

Changed

UITextInput.Changed()

An event that is fired when the value of the text input changes.

Example

element.Changed:Connect(function()
print(element.Text)
end)

Submitted

UITextInput.Submitted()

The event that is triggered when the user submits the text in a text input.

Example

element.Submitted:Connect(function()
print(element.Text)
end)

Properties