Forms

Textarea

A multi-line text field with its label, description, help text and validation error. It can grow with its content, count characters against a limit, and carry a copy button.

Blade

A "Bio" label over a box three rows tall that the user can resize vertically. Inside a Livewire component with a $bio property, the field is bound to it.

Growing with the text #

Two rows at first, growing one row at a time as lines are typed, up to eight; then it scrolls. rows="auto" instead lets the browser size it to the content with no limit (field-sizing: content).

Blade

Character limit #

A "0 / 280" counter under the box, updated as the user types; the browser stops input at 280 characters. counter shows the count without a limit.

Shown in search results.

0 / 280

Blade

Copy button #

A copy button in the corner of the box, which writes the text to the clipboard.

Blade

Label and texts #

The field props work as on any control: label, description, help and placeholder.

Shown to the courier on the shipping label.

Leave empty if there is nothing special.

Blade

Rows and resize #

rows sets the height; resize allows none, vertical, horizontal or both.

Blade

Height from the content #

rows="auto" lets the browser size the box to its content, with no limit.

Blade

Sizes #

size scales the text and the padding.

Blade

Validation #

After a failed validation the message shows under the box, which turns red; the counter stays next to it.

0 / 500

Blade

Customization #

textarea:class styles the <textarea> itself and counter:class the counter; classes on the tag go to the box around it.

0 / 1000

Blade

Reference

tk:textarea

Prop Type Default Description
rows int | string 3 The height in rows. auto sizes it to the content.
maxRows int null Grows the box with the text from rows up to this many rows.
maxlength int null The character limit, with a counter.
counter bool with maxlength Shows the character count.
resize string vertical none, vertical, horizontal or both. Off with maxRows or rows="auto".
copyable bool | string false Adds a copy button. A string is its accessible name.

Also accepts the field props (label, description, help, placeholder, value, size...) and the field control props (icon, prepend, append, loading...). wire:model and x-model bind the text.

Slots

Slot Description
default The initial text, in place of value.

Prefixes

Prefix Goes to
textarea: Classes for the <textarea> itself (textarea:class).
counter: The character counter.
copyable: The copy button.
area: The element around everything, present with a counter or maxRows.

Customization

Classes on the tag go to the box around the textarea (a class alone is enough to render that box); style the textarea itself with textarea:class. Other attributes go to the <textarea>. Besides the prefixes of the field props and field control props (listed in the Reference above).

blade

Accessibility

The label points to the textarea, and aria-describedby lists the description, the help text, the error and the counter, so screen readers can read the remaining characters.

Behavior notes

  • The counter and the height follow Livewire updates and form resets.
  • Inside a Livewire component, when the field is bound (wire:model, or the automatic binding from name), value and the slot are ignored: the bound property is the value.