Skip to content

Email input

Slide your cursor on the preview to see how TW handles valid vs invalid emails.

textual_wizard.inputs.Email

Email(
    name: str,
    label: str,
    *,
    validators: Optional[list[Validator]] = None,
    placeholder: Optional[str] = None,
    initial_value: Optional[str] = None,
    allow_blank: bool = False,
    default_value: Optional[FieldValueType] = None
)

Bases: Text

The email input field behaves like a normal text input field, but simply adds an email validator.

PARAMETER DESCRIPTION
name

The input identifier, used as key in the returned answers dict.

TYPE: str

label

The title of the input, displayed to the user.

TYPE: str

validators

A list of Textual validators, allowing the user to pass to the next question or displaying an error.

TYPE: Optional[list[Validator]] DEFAULT: None

placeholder

Placeholder for the text field.

TYPE: Optional[str] DEFAULT: None

initial_value

Initial value entered in the input.

TYPE: Optional[str] DEFAULT: None

allow_blank

Whether or not the text field is considered valid when is it empty.

TYPE: bool DEFAULT: False

default_value

The value returned by the input if allow_blank is set to True and the input is empty.

TYPE: Optional[FieldValueType] DEFAULT: None

inq_ask

inq_ask() -> FieldValueType

Asks a question using Inquirer instead of the Textual User Interface.

is_value_accepted

is_value_accepted(value: str) -> ValidationResult

Determine if a value satisfies all the validators configured on the question.

PARAMETER DESCRIPTION
value

The value your want to check the validity of.

TYPE: str