SearchBox

A search box provides an input field for searching content within a site or app to find specific items.

Properties#

NameTypeDefaultDescription
valuestringThe value of the text in the SearchBox.
placeholderstringPlaceholder for the search box.
underlinedboolfalseWhether or not the SearchBox is underlined.
iconstringReplace "search" icon with a custom one.
iconColorstringIcon color.
datastringAdditional data attached to the control. The value is passed in event data.
onChangeboolfalseWhether change event should be fired while text is typed into the SearchBox.

Events#

NameDescription
searchFires when the user presses Enter in the search box.
clearFires when the user clears the search box by either clicking 'X' or hitting escape.
escapeFires when the user presses Esc in the search box.
changeFires when the typed input for the SearchBox has changed. For performance optimization this event is disabled unless onChange property set to true.

Examples#

Adding a new SearchBox control onto the page:

sb = page.add(SearchBox(placeholder="Search by city name", on_search=perform_search))