Skip to content

input

A control that displays some text that can potentially be edited.

Properties

Name Type Default Description
value(★) Any
dynamic
None

The value represented by this control.

password bool False

If True, the text is obscured: all input characters are displayed as an asterisk ('*').

label str None

The label associated with the input.

multiline bool False

If True, the text is presented as a multi line input.

lines_shown int 5

The number of lines shown in the input control, when multiline is True.

type str "text"

The type of generated input HTML element, as defined in [HTML input types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types).
This value forces certain values to be entered and can be set to "text", "tel", "email", "url"..., among other choices.

change_delay int App config

Minimum interval between two consecutive calls to the on_change callback.
The default value is defined at the application configuration level by the change_delay configuration option.
if None, the delay is set to 300 ms.
If set to -1, the input change is triggered only when the user presses the Enter key.

on_action Union[str, Callable]

A function or the name of a function that is triggered when a specific key is pressed.
This function is invoked with the following parameters:

  • state (State): the state instance.
  • id (str): the identifier of the control if it has one.
  • payload (dict): the details on this callback's invocation.
    This dictionary has the following keys:
    • action: the name of the action that triggered this callback.
    • args (list):
      • key name
      • variable name
      • current value

action_keys str "Enter"

Semicolon (';')-separated list of supported key names.
Authorized values are Enter, Escape, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12.

width Union[str,int] None

The width of the element.

on_change Union[str, Callable]

A function or the name of a function that is triggered when the value is updated.
This function is invoked with the following parameters:

  • state (State): the state instance.
  • var_name (str): the variable name.
  • value (Any): the new value.

propagate bool App config

Allows the control's main value to be automatically propagated.
The default value is defined at the application configuration level by the propagate configuration option.
If True, any change to the control's value is immediately reflected in the bound application variable.

active bool
dynamic
True

Indicates if this component is active.
An inactive component allows no user interaction.

id str

The identifier that is assigned to the rendered HTML component.

properties dict[str, Any]

Bound to a dictionary that contains additional properties for this element.

class_name str
dynamic

The list of CSS class names that are associated with the generated HTML Element.
These class names are added to the default taipy-input class name.

hover_text str
dynamic

The information that is displayed when the user hovers over this element.

(★)value is the default property for this visual element.

Usage

Get user input

You can create an input field bound to a variable with the following content:

Definition

<|{value}|input|>
<taipy:input>{value}</taipy:input>
import taipy.gui.builder as tgb
...
tgb.input("{value}")

Styling

All the input controls are generated with the "taipy-input" CSS class. You can use this class name to select the input controls on your page and apply style.

Stylekit support

The Stylekit provides a specific class that you can use to style input controls:

  • fullwidth
    If an input control uses the fullwidth class, then it uses the whole available horizontal space.