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"),
},
},
)- kind: TextArea
id: confirm_yaml_textarea
label: "@t/components.textarea.confirm.yaml_label"
value: YAML text area
placeholder: "@t/components.textarea.confirm.placeholder"
rows: 2
onChangeAction:
name: components.textarea_confirm_action
context:
source: yaml_change
confirm:
text: "@t/components.textarea.confirm.prompt"
confirm_text: "@t/components.textarea.confirm.accept"
cancel_text: "@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,
)- kind: TextArea
id: components_test_forms_yaml_textarea
label: "TextArea YAML"
value: {type: store, scope: page, path: /components_test/forms/textarea/store, default: "Initial notes"}
placeholder: "Write notes"
rows: 2Runtime¶
Use collect_input_ids to read the current text. Use value.set property updates, stateUpdate, or dataModelUpdate to change the value from an action.