Textbox

Represents a textbox element with optional label, hint and validation messages.

Properties#

NameTypeDefaultDescription
valuestringCurrent value of the textbox.
labelstringLabel to display above the textbox.
placeholderstringThe short hint displayed in the textbox before the user enters a value.
errorMessagestringStatic error message displayed below the textbox.
descriptionstringDescription displayed below the textbox to provide additional details about what text to enter.
multilineboolfalseWhether or not the text field is a multiline text field.
alignstringleftText alignment within textbox: left or right.
passwordboolfalseWhether the textbox is a masked field for entering password.
onChangeboolfalseWhether change event should be fired while text is typed into the Textbox.

Events#

NameDescription
changeFires when the typed input for the Textbox has changed. For performance optimization this event is disabled unless onChange property set to true.

Examples#

Adding a new textbox control onto the page:

txt_name = page.add(Textbox(label="Your name", placeholder="Enter your name", description="This is your full name"))

Retrieving the value entered into textbox:

your_name = page.get_value(txt_name)
print(f'Your name: {your_name}')

Add multiline textbox and then output a couple of lines into it:

txt_log = page.add(Textbox(label="Operations", multiline=True))
for i in range(5):
page.append(txt_log, f'Line {i}\n')