Basic Usage
Attributes
The textarea name attribute. Used for form submission and error handling.
The label text displayed for the textarea. If empty, a label will be auto-generated from the name.
The number of visible text rows.
The model instance to bind to. The component will automatically fetch the value from the model using the name attribute.
The default value if no model value or old input exists.
Explicitly set the textarea value, overriding model and default values.
Whether to display validation errors below the textarea.
Whether to display the label. Set to
false to hide the label.Custom placeholder text for the textarea.
Automatically use the label as placeholder text when
true.Enable WYSIWYG editor functionality. Adds the
wysiwyg CSS class and includes necessary scripts.Mark the textarea as required. Adds HTML5 required attribute and displays a required indicator on the label.
Display the label and textarea inline (horizontal layout).
Enable Bootstrap floating label style.
Additional CSS classes for the inline label wrapper.
Additional CSS classes for the inline input wrapper.
Enable JavaScript-based error display for client-side validation.
Specify a custom framework theme. Defaults to the configured framework.
Examples
Basic Textarea
Custom Row Height
With Default Value
With Model Binding
Required Field
With Placeholder
Floating Label
WYSIWYG Editor
Inline Layout
Without Label
With Explicit Value
With Additional Attributes
With Help Text
Value Resolution
The component resolves the textarea value in the following order:- Explicit
valueparameter (if provided) - Old input (from validation errors)
- Model value (if model is provided)
- Default value (if specified)
- Empty string
WYSIWYG Editor
Whenwysiwyg is enabled:
- The
wysiwygCSS class is added to the textarea - WYSIWYG initialization scripts are automatically included
- The scripts are pushed to the configured scripts stack (only once per page)
Validation Error Display
When validation fails, the textarea automatically:- Adds the
is-invalidBootstrap class - Displays error messages below the textarea (if
showErrorsistrue) - Preserves user input through Laravel’s old input
Implementation Details
The Textarea component:- Extends the base Input component with type set to
textarea - Uses a separate Blade view (
textarea.blade.php) for rendering - Supports all standard HTML textarea attributes via attribute merging
- Integrates with Laravel’s validation error bag
- HTML content in the value is rendered as-is (using
{!! $value !!})
/src/Views/Components/Textarea.php:16