Skip to content

Text Input API Reference#

TextInput #

TextInput(
    *,
    label: str,
    style: hikari.TextInputStyle = hikari.TextInputStyle.SHORT,
    placeholder: str | None = None,
    value: str | None = None,
    required: bool = False,
    min_length: int | None = None,
    max_length: int | None = None,
    custom_id: str | None = None,
    row: int | None = None
)

Bases: ModalItem

A text input field that can be used in modals.

PARAMETER DESCRIPTION
label

The label above the text input field.

TYPE: str

style

The style of the text input

TYPE: hikari.TextInputStyle DEFAULT: hikari.TextInputStyle.SHORT

placeholder

Placeholder content in the text input

TYPE: Optional[str] DEFAULT: None

value

Pre-filled content of the input field

TYPE: Optional[str] DEFAULT: None

required

If the text input is required for modal submission

TYPE: bool DEFAULT: False

min_length

The minimum required input length of the text input

TYPE: Optional[int] DEFAULT: None

max_length

The maximum allowed input length of the text input

TYPE: Optional[int] DEFAULT: None

custom_id

The custom identifier of the text input

TYPE: Optional[str] DEFAULT: None

row

The row of the text input

TYPE: Optional[int] DEFAULT: None

row property writable #

row: int | None

The row the item should occupy. Leave as None for automatic placement.

position property writable #

position: int | None

The position of the item within the row it occupies.

custom_id property writable #

custom_id: str

The item's custom identifier. This will be used to track the item through interactions and is required for persistent views.

width property #

width: int

The item's width taken up in a Discord UI action row.

modal property #

modal: Modal | None

The modal this item is attached to.

required property writable #

required: bool

Indicates whether the item is required or not.

type property #

The component's underlying component type.

style property writable #

The text input's style.

label property writable #

label: str

The text input's label. This is the text visible above the text input.

placeholder property writable #

placeholder: str | None

Placeholder content for this text input field.

value property writable #

value: str | None

Pre-filled content that should be included in the text input. After sending the modal, this field will be updated to the user's input.

min_length property writable #

min_length: int | None

What the required minimum length of the input text should be.

max_length property writable #

max_length: int | None

What the maximum allowed length of the input text should be.