ui.input_text_area
ui.input_text_area(
id,
label,
value='',
*,
width=None,
height=None,
cols=None,
rows=None,
placeholder=None,
resize=None,
autoresize=False,
autocomplete=None,
spellcheck=None,
update_on='change',
)Create a textarea input control for entry of unstructured 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%’.
height : Optional[str] = None-
The CSS height, e.g., ‘400px’, or ‘100%’.
cols : Optional[int] = None-
Value of the visible character columns of the input, e.g., 80. This argument will only take effect if there is not a CSS width rule defined for this element; such a rule could come from the width argument of this function or from a containing page layout such as page_fluid.
rows : Optional[int] = None-
The value of the visible character rows of the input, e.g., 6. If the height argument is specified, height will take precedence in the browser’s rendering.
placeholder : Optional[str] = None-
A hint as to what can be entered into the control.
resize : Optional[Literal[‘none’, ‘both’, ‘horizontal’, ‘vertical’]] = None-
Which directions the textarea box can be resized. Can be one of “both”, “none”, “vertical”, and “horizontal”. The default,
None, will use the client browser’s default setting for resizing textareas. autoresize : bool = False-
If True, then the textarea will automatically resize the height to fit the input text.
autocomplete : Optional[str] = None-
Whether to enable browser autocompletion of the text input (default is “off”). If
None, then it will use the browser’s default behavior. Other possible values include “on”, “name”, “username”, and “email”. See Mozilla’s autocomplete documentation for more. 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 Ctrl/Cmd + Enter is pressed.
Returns
: Tag-
A UI element
Notes
A string containing the current text input. The default value is "" unless value is provided.
See Also
Examples
#| '!! shinylive warning !!': |
#| shinylive does not work in self-contained HTML documents.
#| Please set `embed-resources: false` in your metadata.
#| 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_area(
"caption_regular",
"Caption:",
"Data summary\nwith\nmultiple\nlines",
),
ui.output_text_verbatim("value_regular", placeholder=True),
ui.input_text_area(
"caption_autoresize",
ui.markdown("Caption (w/ `autoresize=True`):"),
"Data summary\nwith\nmultiple\nlines",
autoresize=True,
),
ui.output_text_verbatim("value_autoresize", placeholder=True),
)
def server(input: Inputs, output: Outputs, session: Session):
@render.text
def value_regular():
return input.caption_regular()
@render.text
def value_autoresize():
return input.caption_autoresize()
app = App(app_ui, server)