Skip to content

TextInput

Implementation of discords TextInput object as a Luau builder.

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

Properties

The TextInput instance has no set properties!

Methods

The TextInput instance has no set methods!

Functions

setCustomId

TextInput . setCustomId (

     self: TextInput
     customId: string
)  -> ()

Sets the custom identifier for this text input component.

setStyle

TextInput . setStyle (

     self: TextInput
     style: apiTypes.TextInputStyle
)  -> ()

Sets the style of the text input component.

setLabel

TextInput . setLabel (

     self: TextInput
     label: string
)  -> ()

Sets the label text that appears above the text input field.

setMinLength

TextInput . setMinLength (

     self: TextInput
     minLength: number
)  -> ()

Sets the minimum length of text that can be entered.

setMaxLength

TextInput . setMaxLength (

     self: TextInput
     maxLength: number
)  -> ()

Sets the maximum length of text that can be entered.

setIsRequired

TextInput . setIsRequired (

     self: TextInput
     isRequired: boolean
)  -> ()

Sets whether this text input field is required to be filled.

setValue

TextInput . setValue (

     self: TextInput
     value: string
)  -> ()

Sets the pre-filled value for the text input field.

setPlaceholder

TextInput . setPlaceholder (

     self: TextInput
     placeholder: string
)  -> ()

Sets the placeholder text that appears when no text is entered.

build

TextInput . build (

     self: TextInput
)  -> ()

Responsible for building the TextInput JSON that can be parsed by the Discord API.

new

TextInput . new (

     resource: {
       customId: string?,
       style: apiTypes.TextInputStyle?,
       label: string?,
       minLength: number?,
       maxLength: number?,
       required: boolean?,
       value: string?,
       placeholder: string?,
    }
)  -> ()

Responsible for creating a new TextInput.

local textInput = TextInput.new({
customId = "my_text_input",
style = TextInputStyle.Short,
label = "Enter your name"
})