TextInput#

Download this notebook from GitHub (right-click to download).


import panel as pn
import panel_material_ui as pmui

pn.extension()

The TextInput allows entering any string using an obfuscated text input box.

Discover more on using widgets to add interactivity to your applications in the how-to guides on interactivity. Alternatively, learn how to set up callbacks and (JS-)links between parameters or how to use them as part of declarative UIs with Param.

Parameters:#

For details on other options for customizing the component see the customization guides.

Core#

  • disabled (boolean): Whether the widget is editable

  • enter_pressed (event): An event that triggers when the <enter> key is pressed.

  • value (str): The current value updated when pressing the <enter> key or when the widget loses focus because the user clicks away or presses the tab key.

  • value_input (str): The current value updated on every key press.

Display#

  • color (str): A color variant 'default' (white), 'primary' (blue), 'success' (green), 'info' (yellow), 'light' (light), or 'danger' (red).

  • max_length (int): The maximum number of allowed characters.

  • label (str): The title of the widget

  • placeholder (str): A placeholder string displayed when no value is entered.

  • variant (Literal["filled", "outlined", "standard"]): The variant of the input field.

Styling#

  • sx (dict): Component level styling API.

  • theme_config (dict): Theming API.

Aliases#

For compatibility with Panel certain parameters are allowed as aliases:

  • name: Alias for label


text_input = pmui.TextInput(name='Text Input', placeholder='Enter a string here...')
text_input

TextInput.value returns a string type that can be read out and set like other widgets:

text_input.value

Controls#

The TextInput widget exposes a number of options which can be changed from both Python and Javascript. Try out the effect of these parameters interactively:

pn.Row(text_input.controls(jslink=True), text_input)

Download this notebook from GitHub (right-click to download).