declare class TextInputBuilder extends ComponentBuilder<APITextInputComponent>
A builder that creates API-compatible JSON data for text inputs.
Constructors
data?: Partial<APITextInputComponent>)
constructor(data?: Partial<APITextInputComponent>
Creates a new text input from API data.
Examples:Creating a text input from an API data object:Creating a text input using setters and API data:
const textInput = new TextInputBuilder({
custom_id: 'a cool text input',
label: 'Type something',
style: TextInputStyle.Short,
});
const textInput = new TextInputBuilder({
label: 'Type something else',
})
.setCustomId('woah')
.setStyle(TextInputStyle.Paragraph);
protectedreadonlyexternalPartial<APITextInputComponent> data :
Clears the id of this component, defaulting to a default incremented id.
Inherited from: ComponentBuilder
external setCustomIdcustomId: string) : this (
customId: string
Sets the custom id for this text input.
external setLabellabel: string) : this (
label: string
Sets the label for this text input.
external setMaxLengthmaxLength: number) : this (
maxLength: number
Sets the maximum length of text for this text input.
external setMinLengthminLength: number) : this (
minLength: number
Sets the minimum length of text for this text input.
external setPlaceholderplaceholder: string) : this (
placeholder: string
Sets the placeholder for this text input.
external setRequiredrequired?: boolean) : this (
required?: boolean
Sets whether this text input is required.
external setStylestyle: TextInputStyle) : this (
style: TextInputStyle
Sets the style for this text input.
external setValuevalue: string) : this (
value: string
Sets the value for this text input.
external toJSONvalidationOverride?: boolean) : APITextInputComponent (
validationOverride?: boolean
Serializes this builder to API-compatible JSON data.Note that by disabling validation, there is no guarantee that the resulting object will be valid.