class TextInputBuilder
implements
Equatable<APITextInputComponent | JSONEncodable<APITextInputComponent>>extends
ComponentBuilder<APITextInputComponent>export declare class TextInputBuilder extends ComponentBuilder<APITextInputComponent> implements Equatable<APITextInputComponent | JSONEncodable<APITextInputComponent>>
A builder that creates API-compatible JSON data for text inputs.
Constructors
data?: APITextInputComponent & { type?: ComponentType.TextInput; })
constructor(data?: APITextInputComponent & { type?: ComponentType.TextInput; }
Creates a new text input from API data.
Examples:Creating a select menu option from an API data object:Creating a select menu option using setters and API data:
const textInput = new TextInputBuilder({
custom_id: 'a cool select menu',
label: 'Type something',
style: TextInputStyle.Short,
});
const textInput = new TextInputBuilder({
label: 'Type something else',
})
.setCustomId('woah')
.setStyle(TextInputStyle.Paragraph);
readonlyPartial<APITextInputComponent> data :
The API data associated with this component.
Inherited from: ComponentBuilder
equals) : boolean (
Whether this is equal to another structure.
setCustomIdcustomId: string) : this (
customId: string
Sets the custom id for this text input.
setLabellabel: string) : this (
label: string
Sets the label for this text input.
setMaxLengthmaxLength: number) : this (
maxLength: number
Sets the maximum length of text for this text input.
setMinLengthminLength: number) : this (
minLength: number
Sets the minimum length of text for this text input.
setPlaceholderplaceholder: string) : this (
placeholder: string
Sets the placeholder for this text input.
setRequiredrequired?: boolean) : this (
required?: boolean
Sets whether this text input is required.
setStylestyle: TextInputStyle) : this (
style: TextInputStyle
Sets the style for this text input.
setValuevalue: string) : this (
value: string
Sets the value for this text input.
toJSONAPITextInputComponent () :
Serializes this builder to API-compatible JSON data.