{{--
Themed multi-line input.
Props are x-form.input's, minus `type` and plus `rows` (default 3). The
value is rendered as element content, never as an attribute.
---
spatie/laravel-html variant. Note ->text() rather than the package's
Textarea::value(), which sets the content as raw HTML.
--}}
@props([
'name',
'label' => null,
'value' => null,
'required' => false,
'rows' => 3,
'groupClass' => null,
])
@php
$fieldId = $attributes->get('id') ?? form_field_id($name);
$error = form_error_message($name);
$control = html()->textarea()
->class('form-control')
->addClassIf($error !== null, 'is-invalid')
->id($fieldId)
->name($name)
->rows((int) $rows)
->attributeIf((bool) $required, 'required')
->attributeIf($error !== null, 'aria-invalid', 'true')
->attributeIf($error !== null, 'aria-describedby', form_field_id($name).'_error')
->text(form_input_value($name, $value) ?? '');
$passthrough = form_passthrough_attributes($attributes);
$control = $control->attributes($passthrough);
@endphp
{!! $control->render() !!}