shiny.ui.input_text#

shiny.ui.input_text(id, label, value='', *, width=None, placeholder=None, autocomplete='off', spellcheck=None)#

Create an input control for entry of text values

Parameters
  • id (str) – An input id.

  • label (Union[Tagifiable, Tag, MetadataNode, str, TagList, float, None, Dict[str, Union[str, float, bool, None]], Sequence[Union[Tagifiable, Tag, MetadataNode, str, TagList, float, None, Dict[str, Union[str, float, bool, None]], Sequence[ForwardRef]]]]) – An input label.

  • value (str) – Initial value.

  • width (Optional[str]) – The CSS width, e.g. ‘400px’, or ‘100%’

  • placeholder (Optional[str]) – A hint as to what can be entered into the control.

  • autocomplete (Optional[str]) – Whether to enable browser autocompletion of the text input (default is None). If None, then it will use the browser’s default behavior. Other possible values include “on”, “off”, “name”, “username”, and “email”. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete for more.

  • spellcheck (Optional[Literal[‘true’, ‘false’]]) – Whether to enable browser spell checking of the text input (default is None). If None, then it will use the browser’s default behavior.

Return type

A UI element

Notes

Server value

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

See also

input_text_area

Example

#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
from shiny import *

app_ui = ui.page_fluid(
    ui.input_text("caption", "Caption:", "Data summary"),
    ui.output_text_verbatim("value"),
)

def server(input: Inputs, output: Outputs, session: Session):
    @output
    @render.text
    def value():
        return input.caption()


app = App(app_ui, server)