# `LedgerUI.Components.Textarea`
[🔗](https://github.com/devaction-labs/ledger_ui/blob/v0.2.0/lib/ledger_ui/components/textarea.ex#L1)

Multi-line text field: `outlined`, `filled` or `plain`, fixed or resizable, with a live
character counter, autogrow, `{{token}}` highlighting and optional header/footer bars.

    <.textarea field={@form[:bio]} label="Bio" variant="filled" resizable />
    <.textarea name="note" maxlength={200} counter autogrow max_rows={8} />
    <.textarea name="why" counter min_length={20} counter_format="%{count} de %{max}" />
    <.textarea name="msg" tokens value="A fatura {{fatura.numero}} esta atrasada." />

    <.textarea name="post" rows={5}>
      <:header><span class="lu-xs lu-muted">Variaveis</span></:header>
      <:footer><span>toolbar</span></:footer>
    </.textarea>

With `counter`, `maxlength` is a soft limit: the counter warns from 90% and turns red past it,
and the browser does not refuse the characters (validate on the server).

The counter (`counter`), `autogrow` and `tokens` run in the `LedgerUI.Textarea` hook, which
needs a stable `id` (it comes from `field`, or `name`). The counter updates while typing, without
the server. A plain textarea needs no hook.

# `textarea`

Renders a `<textarea>` inside the `lu-ta` frame, with its caption, help and errors.
## Attributes

* `field` (`Phoenix.HTML.FormField`) - Defaults to `nil`.
* `id` (`:string`) - Defaults to `nil`.
* `name` (`:string`) - Defaults to `nil`.
* `value` (`:any`) - Defaults to `nil`.
* `rows` (`:integer`) - Lines shown. The design's field is 84px high (3 lines of 21px, `min-height`): more lines make it taller. Defaults to `3`.
* `variant` (`:string`) - Defaults to `"outlined"`. Must be one of `"outlined"`, `"filled"`, or `"plain"`.
* `size` (`:string`) - Defaults to `nil`.Must be one of `nil`, `"sm"`, `"md"`, or `"lg"`.
* `resizable` (`:boolean`) - Defaults to `false`.
* `counter` (`:boolean`) - Defaults to `false`.
* `counter_format` (`:string`) - Defaults to `"%{count} / %{max}"`.
* `counter_align` (`:string`) - Defaults to `"end"`. Must be one of `"end"`, or `"start"`.
* `min_length` (`:integer`) - Defaults to `nil`.
* `autogrow` (`:boolean`) - Defaults to `false`.
* `max_rows` (`:integer`) - Defaults to `nil`.
* `tokens` (`:boolean`) - Defaults to `false`.
* `state` (`:string`) - Defaults to `nil`.Must be one of `nil`, `""`, `"success"`, or `"error"`.
* `label` (`:string`) - Defaults to `nil`.
* `label_class` (`:any`) - Defaults to `nil`.
* `label_hint` (`:string`) - Defaults to `nil`.
* `help` (`:string`) - Defaults to `nil`.
* `errors` (`:list`) - Defaults to `[]`.
* `disabled` (`:boolean`) - Defaults to `false`.
* `wrapper_class` (`:any`) - Defaults to `nil`.
* `frame_class` (`:any`) - Defaults to `nil`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted. Supports all globals plus: `["autocomplete", "autofocus", "cols", "form", "maxlength", "minlength", "placeholder", "readonly", "required", "wrap"]`.
## Slots

* `footer` - Content below the text, laid out as a row (a `lu-cnt` goes to the end).
* `header` - Content above the text, laid out as a row.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
