Skip to content

textarea

Multi-line text field, also the base for WYSIWYG and code editors.

Lte3::textarea(string $name, mixed $value = null, array $attrs = [])

Blade: lte3::components.textarea. The value is resolved as described in Value resolution.

{!! Lte3::textarea('message', 'Hello World!', [
'label' => 'Message',
'rows' => 3,
]) !!}
AttrTypeDefaultDescription
labelstringStr::studly($name)Label HTML. '' hides it.
helpstring-Help HTML under the field.
classstring-Extra classes of the <textarea>, e.g. an editor class.
class_wrapstring-Extra classes of the wrapper .form-group.
hidden_wrapboolfalseHides the whole field.
disabledboolfalseAdds disabled; the field is not submitted.
readonlyboolfalseAdds readonly.
tokensarray-[token => title] dropdown inside the field.
tokens_actionstringcopycopy, insert or none.
attrsarray-Arbitrary HTML attributes of the textarea.
dataarray-data-* attributes of the textarea.
defaultmixed-Fallback value.
formattercallable or class-Transforms the value before rendering, see Formatter.

Keys from lte3.view.field_attrs are printed on the textarea; the useful ones here are rows, placeholder, required, maxlength, minlength, pattern, id, style.

Works as in text: a dropdown in the bottom right corner of the field with copy (clipboard), insert (at the cursor) or none action.

{!! Lte3::textarea('body', null, [
'label' => 'Template',
'rows' => 6,
'tokens' => ['[user:name]' => 'Name', '[order:number]' => 'Order number'],
'tokens_action' => 'insert',
]) !!}

With insert, if the textarea is attached to a TinyMCE editor, the token is inserted into the editor content.

An editor is enabled by a class on the textarea:

{!! Lte3::textarea('body', null, ['label' => 'Body', 'class' => 'f-tinymce']) !!}
{!! Lte3::textarea('body_md', null, ['class' => 'f-md-editor']) !!}

Available classes (f-tinymce, f-summernote, f-codeMirror, f-md-editor, CKEditor 4 f-cke-mini / f-cke-small / f-cke-full) and their setup are described in Editors.

pattern is printed on the textarea and checked live by the package script, see Pattern validation.

name — the text (nothing when disabled).

  • text — single-line input with the same tokens dropdown.
  • Fields overview.
  • Config: lte3.view.components.textarea, lte3.view.field_attrs.