Text¶
- class marimo.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)¶
A text input.
Example.
text = mo.ui.text(value="Hello, World!")
Attributes.
value
: a string of the input’s contents
Initialization Args.
value
: default value of text boxplaceholder
: placeholder text to display when the text area is emptykind
: input kind, one of"text"
,"password"
,"email"
, or"url"
defaults to"text"
max_length
: maximum length of inputdisabled
: whether the input is disableddebounce
: whether the input is debounced. If number, debounce by that many milliseconds. If True, then value is only emitted on Enter or when the input loses focus.label
: markdown label for the elementon_change
: optional callback to run when this element’s value changesfull_width
: whether the input should take up the full width of its container
Public methods
Inherited from
UIElement
form
([label, bordered, loading, ...])Create a submittable form out of this
UIElement
.send_message
(message, buffers)Send a message to the element rendered on the frontend from the backend.
Inherited from
Html
batch
(**elements)Convert an HTML object with templated text into a UI element.
center
()Center an item.
right
()Right-justify.
left
()Left-justify.
callout
([kind])Create a callout containing this HTML element.
style
([style])Wrap an object in a styled container.
Public Data Attributes:
Inherited from
UIElement
value
The element’s current value.
Inherited from
Html
text
A string of HTML representing this element.