Textarea
The multi-line field that grows with its content up to maxRows, sharing the input’s label/hint/error frame.
Real scenarios
The component as it is used in a product — not a specimen grid.
Order note at checkout
Two rows to start, then the field grows line by line with what the customer writes; past five rows it stops growing and scrolls inside, so the receipt stays compact. Whatever is typed lands on the picking list below, exactly as it will be printed.
Delivery hour, exact address or packaging notes — printed on the picking list.
Picking list: no note yet
A support reply worth sending
Required and validated while typing: anything shorter than 30 characters gets the red frame, and nothing is sent until it is fixed. The send is slow on purpose, so the button can spin.
The customer reads this verbatim.
A team bio with a hard ceiling
maxlength reaches the native control untouched, so the browser itself stops the typing — the countdown only reports it, in locale digits, and turns warning with 20 left.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| maxRows | int | null | Row ceiling before the field scrolls instead of growing. |
| label / hint / error | string | null | Same as input: the label/hint/error field frame; an omitted error is read from $errors by the field name. |
| rows / placeholder / maxlength | native attrs | — | Any native textarea attribute lands on the control itself; maxlength is enforced by the browser. |
| required | bool | false | The required star on the label and required on the textarea itself. |
Snippet
<x-nx::textarea label="یادداشت سفارش" hint="برای انباردار" rows="2" :maxRows="5"
wire:model.blur="state.note" />
<x-nx::textarea label="پاسخ تیکت" required :maxRows="8"
:error="$tooShort ? 'دستکم ۳۰ نویسه بنویسید' : null"
wire:model.live.debounce.300ms="state.reply" />
<x-nx::textarea label="معرفی تیم" maxlength="140" :maxRows="3"
wire:model.live="state.bio" />