Basics
Contains all Basic Methods.
The Textarea field is a multi-line text input field in MoonShine. This field is equivalent to the <textarea></textarea> tag.
use MoonShine\UI\Fields\Textarea;Textarea::make('Text')
use MoonShine\UI\Fields\Textarea;Textarea::make('Text')
Field Height
To set the height of the field, you can use attributes.
Textarea::make('Text')->customAttributes(['rows' => 6,])Textarea::make('Text')->customAttributes(['rows' => 6,])
Disabling Escaping
The unescape() method disables the escaping of HTML tags in the field value.
Textarea::make('HTML Content', 'content')->unescape()Textarea::make('HTML Content', 'content')->unescape()
The field inherits the global escapes.value and escapes.value_on_apply settings, both true by default. escapes.value controls both the preview and the value inside the textarea form control.
Explicit escape() and unescape() calls override escapes.value; they do not change escaping when applying submitted values.
Escaping on Apply
As with Text, escapeOnApply() overrides the global setting independently of display escaping:
use MoonShine\UI\Fields\Textarea;Textarea::make('HTML Content', 'content')->escape()->escapeOnApply(fn (Textarea $field): bool => false)
use MoonShine\UI\Fields\Textarea;Textarea::make('HTML Content', 'content')->escape()->escapeOnApply(fn (Textarea $field): bool => false)
This example stores the original string while escaping its display. To explicitly enable escaping on apply even when it is disabled globally, use ->escapeOnApply() without an argument. The field method accepts a closure, not a boolean.