<- Back to Forms Components

TextArea is a multi-line text input. Use it for notes, descriptions, prompts, and longer free text.

Contract

Property Type Notes
label str Input label.
value str Current text value. Supports literal, store binding, and data-model binding.
placeholder str Placeholder shown while empty.
auto_resize bool Allows the client to grow the text area with content.
disabled bool Disables user editing.
rows int Initial visible row count.
onChangeAction action object Action dispatched while editing. Action objects can include confirm.

Value collected by actions: str.

Action Confirmation

TextArea supports confirmation on onChangeAction. If the user cancels the dialog, the change action is not sent to the backend.

The component test page exposes a text-area action counter and the last received payload so dispatch can be checked directly after confirming.

field = sdk.ui.TextArea(
    "confirm_python_textarea",
    label=sdk.i18n.t("components.textarea.confirm.python_label"),
    value="Python text area",
    placeholder=sdk.i18n.t("components.textarea.confirm.placeholder"),
    rows=2,
)
field.set_prop(
    "onChangeAction",
    {
        "name": "components.textarea_confirm_action",
        "context": {"source": "python_change"},
        "confirm": {
            "text": sdk.i18n.t("components.textarea.confirm.prompt"),
            "confirm_text": sdk.i18n.t("components.textarea.confirm.accept"),
            "cancel_text": sdk.i18n.t("components.textarea.confirm.cancel"),
        },
    },
)

Example

field = sdk.ui.TextArea(
    "components_test_forms_textarea_store",
    label="TextArea",
    value=bound.store("/components_test/forms/textarea/store", scope="page", default="Initial notes"),
    placeholder="Write notes",
    rows=2,
)

Runtime

Use collect_input_ids to read the current text. Use value.set property updates, stateUpdate, or dataModelUpdate to change the value from an action.