ui.input_text
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: 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 aboutautocomplete
’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.
Returns
Type | Description |
---|---|
Tag | A UI element |
Notes
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 import App, Inputs, Outputs, Session, render, ui
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):
@render.text
def value():
return input.caption()
app = App(app_ui, server)