---
title: "Textarea component | zenit Zig UI"
description: "Multi-line editing with helper, error and disabled states. Line breaks, selection, scrolling, grapheme boundaries and IME preedit / commit match the…"
url: https://ui.surf/zenit/components/textarea
language: en
alternate_zh: https://ui.surf/zenit/zh/components/textarea.md
alternate_es: https://ui.surf/zenit/es/components/textarea.md
alternate_ja: https://ui.surf/zenit/ja/components/textarea.md
alternate_ko: https://ui.surf/zenit/ko/components/textarea.md
alternate_fr: https://ui.surf/zenit/fr/components/textarea.md
alternate_de: https://ui.surf/zenit/de/components/textarea.md
project: zenit v0.1.0-alpha (Zig 0.15.2, macOS)
source: https://github.com/version-next/zenit
---

# Textarea

`ui.widgets.Textarea`

Multi-line editing with helper, error and disabled states.

[Video](https://ui.surf/zenit/media/stories/textarea.mp4?v=01136a4b5d)

**BEHAVIOR CONTRACT**

Line breaks, selection, scrolling, grapheme boundaries and IME preedit / commit match the single-line input.

**RECORDED INTERACTION**

The harness focuses the box and writes two lines.

`examples/storybook/stories.zig:2923`

```zig
// ── 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;
}
```

[View source on GitHubexamples/storybook/stories.zig:2923](https://github.com/version-next/zenit/blob/HEAD/examples/storybook/stories.zig#L2923)

The story's verbatim source from the Storybook (zenit 4c50245 2026-10-01). `W` is `ui.widgets`; `col` / `row` / `label` are small Storybook layout helpers.

### TextareaProps

`ui.widgets.Textarea`

[src/ui/components/input/textarea.zig:2092](https://github.com/version-next/zenit/blob/HEAD/src/ui/components/input/textarea.zig#L2092)

```zig
fn Textarea(props: TextareaProps) TextareaBuilder
```

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `?[]const u8` | `null` | — |
| `placeholder` | `?[]const u8` | `null` | — |
| `label_text` | `?[]const u8` | `null` | — |
| `helper` | `?[]const u8` | `null` | — |
| `error_msg` | `?[]const u8` | `null` | — |
| `rows` | `u32` | `4` | — |
| `disabled` | `bool` | `false` | — |
| `required` | `bool` | `false` | — |
| `readonly` | `bool` | `false` | — |
| `width` | `?f32` | `null` | — |
| `on_change` | `?core_ui.HandlerRef` | `null` | — |
| `context` | `?*anyopaque` | `null` | — |

### \*Node

`ui.widgets.Textarea`

mount returns `*Node` directly. Append it to a parent.
