TextInput
Represents a text input component builder.
Signature
export declare class TextInput extends BaseComponentBuilder<APITextInputComponent>JSDoc
Examples
const textInput = new TextInput()
.setCustomId("feedback")
.setStyle(TextInputStyle.Paragraph)
.setPlaceholder("Type here");
const label = new Label()
.setLabel("Feedback")
.setComponent(textInput);
const json = label.toJSON();Properties
0No properties.
Methods
7Methods
constructorConstructorconstructor(data?: Partial<APITextInputComponent>);setStyle(style: TextInputStyle): this;Sets the style of the text input.
Parameters
style- The style of the text input.
Returns
The current TextInput instance.
setPlaceholder(placeholder: string): this;Sets the placeholder of the text input.
Parameters
placeholder- The placeholder text.
Returns
The current TextInput instance.
setLength({ max, min }: Partial<OptionValuesLength>): this;Sets the length constraints for the text input.
Parameters
options- The length constraints.
Returns
The current TextInput instance.
setCustomId(id: string): this;Sets the custom ID of the text input.
Parameters
id- The custom ID for the text input.
Returns
The current TextInput instance.
setValue(value: string): this;Sets the initial value of the text input.
Parameters
value- The initial value.
Returns
The current TextInput instance.
setRequired(required?: boolean): this;Sets whether the text input is required.
Parameters
required- Indicates whether the text input is required.
Returns
The current TextInput instance.