Textarea
ui.widgets.TextareaÉdition multiligne avec les états helper, error et disabled.
BEHAVIOR CONTRACT
Retours à la ligne, sélection, défilement, limites de graphèmes et preedit / commit de l'IME se comportent comme dans la saisie sur une ligne.
RECORDED INTERACTION
Le harness met le focus sur la zone et écrit deux lignes.
// ── 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;
}Le code source tel quel de la story dans le Storybook (zenit 5f9add5+wip 2026-09-30). W désigne ui.widgets ; col / row / label sont de petits helpers de mise en page du Storybook.
TextareaProps
ui.widgets.Textareafn Textarea(props: TextareaProps) TextareaBuilderChamp
Type
Défaut
Description
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 renvoie directement *Node : ajoutez-le à un parent.