mo.ui.text
Create a text input field for user input.
Signature
mo.ui.text(
value: str = "",
placeholder: str = "",
kind: Literal["text", "password", "email", "url"] = "text",
max_length: int | None = None,
disabled: bool = False,
debounce: bool | int = True,
*,
label: str = "",
on_change: Callable[[str], None] | None = None,
full_width: bool = False
)
Parameters
Placeholder text shown when empty
kind
'text' | 'password' | 'email' | 'url'
default:"'text'"
Type of input field
Maximum number of characters allowed
Whether the input is disabled
Debounce input updates (True for default delay, or specify milliseconds)
Markdown label for the input
Whether input takes full width
Examples
import marimo as mo
# Basic text input
name = mo.ui.text(placeholder="Enter your name")
name
# Email input with validation
email = mo.ui.text(
kind="email",
placeholder="[email protected]",
label="**Email address**"
)
# Password input
password = mo.ui.text(
kind="password",
placeholder="Enter password",
max_length=50
)
# Use the value
mo.md(f"Hello, {name.value}!")
By default, text inputs are debounced to avoid excessive updates while typing.