express.ui.update_submit_textarea
express.ui.update_submit_textarea(
id,
*,
value=None,
placeholder=None,
label=None,
submit=False,
focus=False,
session=None,
)Update a submit textarea input on the client.
Parameters
id : str-
The input ID.
value : Optional[str] = None-
The value to set the user input to.
placeholder : Optional[str] = None-
The placeholder text for the user input.
label : Optional[TagChild] = None-
The label for the input.
submit : bool = False-
Whether to automatically submit the text for the user. Requires
value. focus : bool = False-
Whether to move focus to the input element. Requires
value. session : Optional[Session] = None-
A
Sessioninstance. If not provided, it is inferred viaget_current_session.
See Also
Examples
#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
## file: app.py
from shiny import reactive, render
from shiny.express import input, ui
ui.input_submit_textarea(
"comment",
label="Your Comment",
placeholder="Type your comment here...",
rows=2,
toolbar=[
ui.input_action_button("clear", "Clear", class_="btn-sm btn-danger"),
ui.input_action_button("template", "Use Template", class_="btn-sm"),
],
)
@reactive.effect
@reactive.event(input.clear)
def _():
ui.update_submit_textarea(
"comment",
value="",
placeholder="Type your comment here...",
)
@reactive.effect
@reactive.event(input.template)
def _():
ui.update_submit_textarea(
"comment",
value="Thank you for your feedback. We appreciate your input!",
placeholder="",
label="Your Comment (Template Applied)",
)
@render.text
def submitted_comment():
if "comment" in input:
return f"Submitted: {input.comment()}"
return "No comment submitted yet."