# <textarea>

A multi-line text field with a label and helper text; name= holds what is typed.

Category: Forms and input.

```ham
<column style="w-full gap-8">
    <textarea id="note"
              name="note"
              label="Message to the host"
              helper="Arrival time, allergies, anything else"
              rows="4"
              autocapitalize="sentences">We land at 14:20 and should arrive around 16:00.</textarea>
    <text @text="#note.length + ' characters'"
          style="muted text-sm"></text>
</column>
```

How Hype Apps draws it on a phone: [light](https://hypeapps.dev/img/tags/textarea-light.webp), [dark](https://hypeapps.dev/img/tags/textarea-dark.webp).

## Attributes

| Name | What it does | Default |
|---|---|---|
| `autocapitalize` | On-screen keyboard auto-capitalization, same vocabulary as HTML. (off, none, on, sentences, words, characters) | `off` |
| `helper` | Helper text |  |
| `icon` | Prefix icon |  |
| `label` | Label |  |
| `name` | Variable name for form scoping |  |
| `placeholder` | Placeholder text |  |
| `rows` | Number of visible text lines. More than one: the keyboard's Return types a new line (the multiline keyboard); 1 is a one-line field. | `3` |
| `style` | Style classes |  |
| `value` | Initial text. Without it, the content (<textarea>text</textarea>) is the initial text, as written but for one newline right after the tag. |  |
| `variant` | As on <input>: outlined, underline (a hairline), or plain (no border, no floating label). (outlined, underline, plain) | `outlined` |

## Commands

| Name | What it does |
|---|---|
| `blur` | Unfocus it (closes the keyboard). |
| `clear` | Empty it and its name= variable. |
| `focus` | Focus the field (opens the keyboard). |

## Readings

| Name | What it does |
|---|---|
| `error` | The validation message for the text; empty when valid. |
| `focused` | Whether the field has the keyboard focus. |
| `length` | How many characters are in the field, live. |
| `max_length` | The max-length= in force (a code input: its length=), in characters; empty when none. |
| `valid` | Whether the text passes the field's rules (required, min-length, pattern …); true with no rules. |
| `value` | The text in the field, live as it is typed. |

Any tag also takes gestures: `@on.tap`, `@on.longpress`, `@on.doubletap` and `@on.swipeleft` (and right, up and down). `@click` runs on a tap too.

## Related tags

- [`<column>`](https://hypeapps.dev/docs/reference/column.md): Stacks its children top to bottom, with a gap between them and an alignment across.
- [`<text>`](https://hypeapps.dev/docs/reference/text.md): A run of text; with @text it shows an expression that updates as its variables change.
- [`<button>`](https://hypeapps.dev/docs/reference/button.md): A tappable button that runs an action: a fetch, a navigation or a statement.
- [`<checkbox>`](https://hypeapps.dev/docs/reference/checkbox.md): A checkbox with a label; its state goes into a variable by name.
- [`<chip>`](https://hypeapps.dev/docs/reference/chip.md): A compact chip: a label, a filter that toggles, a single choice in a set, or an action.
- [`<color-picker>`](https://hypeapps.dev/docs/reference/color-picker.md): A color picker: a hue ring round a disc, with swatches; the chosen color goes into a variable.
- [`<data-cell>`](https://hypeapps.dev/docs/reference/data-cell.md): One cell of a data table row.
- [`<data-column>`](https://hypeapps.dev/docs/reference/data-column.md): A column heading of a data table.

All tags: https://hypeapps.dev/docs/reference.md · The full reference: https://hypeapps.dev/llms.txt
