Skip to content

TextInputComponent ​

classe · Source

Represents a text input component in a modal

Extends: BaseMessageComponent

Constructor ​

new TextInputComponent(data?: TextInputComponent | TextInputComponentOptions)

Parameters

NameTypeDescription
data?TextInputComponent | TextInputComponentOptionsTextInputComponent to clone or raw data Default: {}.

Properties ​

customId ​

nullable

customId: string

A unique string to be sent in the interaction when submitted Source

label ​

nullable

label: string

The text to be displayed above this text input component Source

maxLength ​

nullable

maxLength: number

Maximum length of text that can be entered Source

minLength ​

nullable

minLength: string

Minimum length of text required to be entered Source

placeholder ​

nullable

placeholder: string

Custom placeholder text to display when no text is entered Source

required ​

nullable

required: boolean

Whether or not this text input component is required Source

style ​

nullable

style: TextInputStyle

The style of this text input component Source

value ​

nullable

value: string

Value of this text input component Source

type ​

nullable

type: MessageComponentType

The type of this component Source

data ​

data: MessageComponentOptions

The data for this component Source

id ​

readonly

id: number

The id of this component Source

Methods ​

setValue ​

setValue(value: string): TextInputComponent

Sets the value of this text input component Parameters

NameTypeDescription
valuestringValue of this text input component

Returns: TextInputComponentSource

toJSON ​

toJSON(): APITextInput

Transforms the text input component into a plain object Returns: APITextInput — The raw data of this text input component Source

resolveStyle ​

static · private

resolveStyle(style: TextInputStyleResolvable): TextInputStyle

Resolves the style of a text input component Parameters

NameTypeDescription
styleTextInputStyleResolvableThe style to resolve

Returns: TextInputStyleSource

Unofficial software. Not affiliated with or supported by Discord.