Skip to content

TextInput

Implementation of the Discord TextInput class in Luau

https://discord.com/developers/docs/interactions/message-components#text-input-object-text-input-structure

Properties

type

TextInput.type  :: number

The type of component this is - for text inputs, this is always 4

customId

TextInput.customId  :: string

A developer-defined identifier for the text input, max 100 characters

style

TextInput.style  :: apiTypes.TextInputStyle

The style of the text input field - can be single-line (SHORT) or multi-line (PARAGRAPH)

label

TextInput.label  :: string

The label displayed above the text input field

minLength

TextInput.minLength  :: number?

The minimum length of text the user must input (0-4000)

maxLength

TextInput.maxLength  :: number?

The maximum length of text the user can input (1-4000)

required

TextInput.required  :: boolean?

Whether this text input is required to be filled before the form can be submitted

value

TextInput.value  :: string?

Pre-filled value for the text input field

placeholder

TextInput.placeholder  :: string?

Custom placeholder text shown when the text input field is empty

Methods

The TextInput instance has no set methods!

Functions

sync

TextInput . sync (

     self: TextInput
     textInputData: apiTypes.TextInputComponentObject
)  -> ()

Responsible for syncing data to this text input object. This is typically called by the API when this object is created or updated.

new

TextInput . new (

     textInputData: apiTypes.TextInputComponentObject
)  -> ()

Responsible for constructing this class.