express.ui.input_text

express.ui.input_text(
    id,
    label,
    value='',
    *,
    width=None,
    placeholder=None,
    autocomplete='off',
    spellcheck=None,
    update_on='change',
)

Create an input control for entry of text values.

Parameters

id : str

An input id.

label : TagChild

An input label.

value : str = ''

Initial value.

width : Optional[str] = None

The CSS width, e.g., ‘400px’, or ‘100%’.

placeholder : Optional[str] = None

A hint as to what can be entered into the control.

autocomplete : Optional[str] = 'off'

Whether to enable browser autocompletion of the text input. If None, then it will use the browser’s default behavior. Some values include “on”, “off”, “name”, “username”, and “email”. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete to learn more about autocomplete’s supported values.

spellcheck : Optional[Literal[‘true’, ‘false’]] = None

Whether to enable browser spell checking of the text input (default is None). If None, then it will use the browser’s default behavior.

update_on : Literal[‘change’, ‘blur’] = 'change'

When should the input value be updated? Options are "change" (default) and "blur". Use "change" to update the input immediately whenever the value changes. Use "blur"to delay the input update until the input loses focus (the user moves away from the input), or when Enter is pressed.

Returns

: Tag

A UI element

Notes

Server value

A string containing the current text input. The default value is "" unless value is provided.

See Also

Examples

#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400

## file: app.py
from shiny.express import input, render, ui

ui.input_text("caption", "Caption:", "Data summary")


@render.code
def value():
    return input.caption()