class TextInputBuilder

external
declare class TextInputBuilder extends ComponentBuilder<APITextInputComponent>

A builder that creates API-compatible JSON data for text inputs.

Constructors

constructor()

Creates a new text input from API data.

Examples:Creating a text input from an API data object:
const textInput = new TextInputBuilder({
	custom_id: 'a cool text input',
	label: 'Type something',
	style: TextInputStyle.Short,
});
Creating a text input using setters and API data:
const textInput = new TextInputBuilder({
	label: 'Type something else',
})
	.setCustomId('woah')
	.setStyle(TextInputStyle.Paragraph);

protectedreadonlyexternal
data : Partial<APITextInputComponent>

external
clearId() : this

Clears the id of this component, defaulting to a default incremented id.

Inherited from: ComponentBuilder

external
clearMaxLength() : this

Clears the maximum length of text for this text input.

external
clearMinLength() : this

Clears the minimum length of text for this text input.

external
clearPlaceholder() : this

Clears the placeholder for this text input.

external
clearValue() : this

Clears the value for this text input.

external
setCustomId(
customId: string
) : this

Sets the custom id for this text input.

external
setId(
id: number
) : this

Sets the id of this component.

Inherited from: ComponentBuilder

external
setLabel(
label: string
) : this

Sets the label for this text input.

external
setMaxLength(
maxLength: number
) : this

Sets the maximum length of text for this text input.

external
setMinLength(
minLength: number
) : this

Sets the minimum length of text for this text input.

external
setPlaceholder(
placeholder: string
) : this

Sets the placeholder for this text input.

external
setRequired(
required?: boolean
) : this

Sets whether this text input is required.

external
setStyle() : this

Sets the style for this text input.

external
setValue(
value: string
) : this

Sets the value for this text input.

external
toJSON(
validationOverride?: boolean
) : APITextInputComponent

Serializes this builder to API-compatible JSON data.Note that by disabling validation, there is no guarantee that the resulting object will be valid.