Textarea
ui.widgets.TextareaMehrzeilige Bearbeitung mit den Zuständen helper, error und disabled.
BEHAVIOR CONTRACT
Zeilenumbrüche, Auswahl, Scrollen, Graphemgrenzen und IME-preedit / commit verhalten sich wie bei der einzeiligen Eingabe.
RECORDED INTERACTION
Der Harness fokussiert das Feld und schreibt zwei Zeilen.
// ── Textarea ──
pub fn buildTextarea(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
const a = cx.allocator;
const c = try col(cx, 12);
const ta = try W.Textarea(.{ .label_text = "Notes", .placeholder = "Write something…", .rows = 5, .width = 420 }).mount(scope, cx);
ta.meta.ownership.meta.test_id = "story.textarea.box";
try c.appendChild(a, ta);
try c.appendChild(a, try W.Textarea(.{ .label_text = "With helper", .placeholder = "Bio", .helper = "Max 500 characters", .rows = 3, .width = 420 }).mount(scope, cx));
try c.appendChild(a, try W.Textarea(.{ .label_text = "With error", .value = "too short", .error_msg = "Please write more", .rows = 3, .width = 420 }).mount(scope, cx));
try c.appendChild(a, try W.Textarea(.{ .label_text = "Disabled", .placeholder = "Cannot edit", .disabled = true, .rows = 3, .width = 420 }).mount(scope, cx));
return c;
}Der unveränderte Quellcode der Story aus dem Storybook (zenit 5f9add5+wip 2026-09-30). W steht für ui.widgets; col / row / label sind kleine Layout-Helfer des Storybooks.
TextareaProps
ui.widgets.Textareafn Textarea(props: TextareaProps) TextareaBuilderFeld
Typ
Standard
Beschreibung
value?[]const u8null—
placeholder?[]const u8null—
label_text?[]const u8null—
helper?[]const u8null—
error_msg?[]const u8null—
rowsu324—
disabledboolfalse—
requiredboolfalse—
readonlyboolfalse—
width?f32null—
on_change?core_ui.HandlerRefnull—
context?*anyopaquenull—
*Node
ui.widgets.Textareamount gibt *Node direkt zurück – hängen Sie es an einen Elternknoten an.