Skip to content

TextInput

Represents a text input component builder.

Example

1
const textInput = new TextInput().setLabel("Enter text");
2
textInput.setStyle(TextInputStyle.Paragraph);
3
textInput.setPlaceholder("Type here");
4
const json = textInput.toJSON();

Extends

Constructors

new TextInput(data)

1
new TextInput(data: Partial<APITextInputComponent>): TextInput

Creates a new TextInput instance.

Parameters

ParameterTypeDescription
dataPartial<APITextInputComponent>Optional data for the text input.

Returns

TextInput

Overrides

BaseComponentBuilder.constructor

Source

seyfert/src/builders/Modal.ts:118

Properties

PropertyModifierTypeInherited from
datapublicPartial<APITextInputComponent>BaseComponentBuilder.data

Methods

setCustomId()

1
setCustomId(id: string): this

Sets the custom ID of the text input.

Parameters

ParameterTypeDescription
idstringThe custom ID for the text input.

Returns

this

The current TextInput instance.

Source

seyfert/src/builders/Modal.ts:168


setLabel()

1
setLabel(label: string): this

Sets the label of the text input.

Parameters

ParameterTypeDescription
labelstringThe label of the text input.

Returns

this

The current TextInput instance.

Source

seyfert/src/builders/Modal.ts:137


setLength()

1
setLength(options: Partial<OptionValuesLength>): this

Sets the length constraints for the text input.

Parameters

ParameterTypeDescription
optionsPartial<OptionValuesLength>The length constraints.

Returns

this

The current TextInput instance.

Source

seyfert/src/builders/Modal.ts:157


setPlaceholder()

1
setPlaceholder(placeholder: string): this

Sets the placeholder of the text input.

Parameters

ParameterTypeDescription
placeholderstringThe placeholder text.

Returns

this

The current TextInput instance.

Source

seyfert/src/builders/Modal.ts:147


setRequired()

1
setRequired(required: boolean): this

Sets whether the text input is required.

Parameters

ParameterTypeDefault valueDescription
requiredbooleantrueIndicates whether the text input is required.

Returns

this

The current TextInput instance.

Source

seyfert/src/builders/Modal.ts:188


setStyle()

1
setStyle(style: TextInputStyle): this

Sets the style of the text input.

Parameters

ParameterTypeDescription
styleTextInputStyleThe style of the text input.

Returns

this

The current TextInput instance.

Source

seyfert/src/builders/Modal.ts:127


setValue()

1
setValue(value: string): this

Sets the initial value of the text input.

Parameters

ParameterTypeDescription
valuestringThe initial value.

Returns

this

The current TextInput instance.

Source

seyfert/src/builders/Modal.ts:178


toJSON()

1
toJSON(): APITextInputComponent

Returns

APITextInputComponent

Inherited from

BaseComponentBuilder.toJSON

Source

seyfert/src/builders/Base.ts:8