Creating a Textarea Input Field


You want to add a textarea to your Blade template.


Use the Form::textarea() method.

The simplest usage is to only pass a single argument, the name.

{{ Form::textarea('notes') }}

This produces the following HTML.

<textarea name="notes" cols="50" rows="10"></textarea>

Notice the default cols and rows.

You can pass the value as the second argument.

{{ Form::textarea('notes', '3 < 4') }}

The value will be escaped.

<textarea name="notes" cols="50" rows="10">3 &lt; 4</textarea>

Additional options can be passed as a third argument. This must be an array.

{{ Form::textarea('notes', null, ['class' => 'field']) }}

This will add the class "field" to the text area.

<textarea class="field" name="notes" cols="50" rows="10"></textarea>


You can use an undocumented "size" attribute.

If the text area has an attribute named "size" it should be in the format "30x5" where the first digit (20) represents the columns and the second digit represents the rows.

{{ Form::textarea('notes', null, ['size' => '30x5']) }}

Will produce.

<textarea name="notes" cols="30" rows="5"></textarea>
comments powered by Disqus