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

TextInput.customId  :: string?

The custom identifier for the text input component.

TextInput.style  :: TextInputStyle?

The style of the text input component.

TextInput.label  :: string?

The label text that appears above the text input field.

TextInput.minLength  :: number?

The minimum length of text that can be entered.

TextInput.maxLength  :: number?

The maximum length of text that can be entered.

TextInput.required  :: boolean?

Whether this text input field is required to be filled.

TextInput.value  :: string?

The pre-filled value for the text input field.

TextInput.placeholder  :: string?

The placeholder text that appears when no text is entered.

TextInput : setCustomId ( customId )  -> TextInput

Sets the custom identifier for this text input component.

Parameters

customId: string

Returns

TextInput
TextInput : setStyle ( style )  -> TextInput

Sets the style of the text input component.

Parameters

style: TextInputStyle

Returns

TextInput
TextInput : setLabel ( label )  -> TextInput

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

Parameters

label: string

Returns

TextInput
TextInput : setMinLength ( minLength )  -> TextInput

Sets the minimum length of text that can be entered.

Parameters

minLength: number

Returns

TextInput
TextInput : setMaxLength ( maxLength )  -> TextInput

Sets the maximum length of text that can be entered.

Parameters

maxLength: number

Returns

TextInput
TextInput : setIsRequired ( isRequired )  -> TextInput

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

Parameters

isRequired: boolean

Returns

TextInput
TextInput : setValue ( value )  -> TextInput

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

Parameters

value: string

Returns

TextInput
TextInput : setPlaceholder ( placeholder )  -> TextInput

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

Parameters

placeholder: string

Returns

TextInput
TextInput : build ( )  -> JSON

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

Returns

JSON
TextInput . new ( resource )  -> TextInput

Responsible for creating a new TextInput.

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

Parameters

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

Returns

TextInput