Text Input
Last Updated: August 10, 2015
- class tethys_sdk.gizmos.TextInput(name, display_text='', initial='', placeholder='', prepend='', append='', icon_prepend='', icon_append='', disabled=False, error='', success='', attributes=None, classes='')
The text input gizmo makes it easy to add text inputs to your app that are styled similarly to the other input snippets.
- icon_prepend
The name of a valid Bootstrap Icon (see Bootstrap Icons). The icon will be prepended to the input.
- Type:
str
- icon_append
The name of a valid Bootstrap Icon (see Bootstrap Icons). The icon will be appended to the input.
- Type:
str
- attributes
A dictionary representing additional HTML attributes to add to the primary element (e.g. {"onclick": "run_me();"}).
- Type:
dict
- classes
Additional classes to add to the primary HTML element (e.g. "example-class another-class").
- Type:
str
Controller Example
pythonfrom tethys_sdk.gizmos import TextInput text_input = TextInput( display_text='Text', name='inputAmount', placeholder='e.g.: 10.00', prepend='$' ) text_error_input = TextInput( display_text='Text Error', name='inputEmail', initial='bob@example.com', disabled=True, icon_append='envelope', error='Here is my error text' ) context = { 'text_input': text_input, 'text_error_input': text_error_input, }
Template Example
python{% gizmo text_input %} {% gizmo text_error_input %}