express.ui.input_submit_textarea
express.ui.input_submit_textarea(
id,
label=None,
*,
placeholder=None,
value='',
width='min(680px, 100%)',
rows=1,
button=None,
toolbar=None,
submit_key='enter+modifier',
**kwargs,
)Create a textarea input control with explicit submission.
Creates a textarea input where users can enter multi-line text and submit their input using a dedicated button or keyboard shortcut. This control is ideal when you want to capture finalized input, rather than reacting to every keystroke, making it useful for chat boxes, comments, or other scenarios where users may compose and review their text before submitting.
Parameters
id : str-
The input ID.
label : TagChild = None-
The label to display above the input control. If
None, no label is displayed. placeholder : Optional[str] = None-
The placeholder text to display when the input is empty. This can be used to provide a hint or example of the expected input.
value : str = ''-
The initial input text. Note that, unlike
input_text_area, this won’t set a server-side value until the value is explicitly submitted. width : str = 'min(680px, 100%)'-
Any valid CSS unit (e.g.,
width="100%"). rows : int = 1-
The number of rows (i.e., height) of the textarea. This essentially sets the minimum height – the textarea can grow taller as the user enters more text.
button : Optional[Tag] = None-
A
Tagelement to use for the submit button. It’s recommended that this be aninput_task_buttonsince it will automatically provide a busy indicator (and disable) until the next flush occurs. Note also that if the submit button launches anExtendedTask, this button can also be bound to the task (bind_task_button) and/or manually updated for more accurate progress reporting (update_task_button). toolbar : TagChild | TagAttrValue = None-
UI elements to include alongside the submit button (e.g., help text, links, etc.).
submit_key : Literal[‘enter+modifier’, ‘enter’] = 'enter+modifier'-
A string indicating what keyboard event should trigger the submit button. The default is
"enter+modifier", which requires the user to hold down Ctrl (or Cmd on Mac) before pressing Enter to submit. This helps prevent accidental submissions. To allow submission with just the Enter key, use"enter". In this case, the user can still insert new lines using Shift+Enter or Alt+Enter. ****kwargs** : TagAttrValue = {}-
Additional attributes to apply to the underlying
<textarea>element (e.g., spellcheck, autocomplete, etc).
Returns
: Tag-
A textarea input control that can be added to a UI definition.
Notes
A character string containing the user’s text input.
Important: The server isn’t sent a value until the user explicitly submits the input. This means that reading the input value results in a SilentException until the user actually submits input. After that, the server will only see updated values when the user submits the input again. For this reason, if you want to avoid the exception and return a value, check for the input ID using if "input_id" in input before reading the value. See the examples for a demonstration.
See Also
Examples
#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
## file: app.py
import time
from shiny.express import input, render, ui
ui.input_submit_textarea("text", placeholder="Enter some input...")
@render.text
def value():
if "text" in input:
# Simulate processing time
time.sleep(2)
return f"You entered: {input.text()}"
else:
return "Submit some input to see it here."