textarea() form()

A multi-line text field; the value is escaped, a rich editor can replace it.

form()->textarea($name, $desc = '', $extra = [], $replace = [])

Options

OptionMeaning
rows, colsSize.
no_escapePrint the value as it is (trusted HTML only).
ckeditorMake it a CKEditor (legacy; the site must ship CKEditor).
tinymceMake it a TinyMCE editor: see tinymce().
contenteditablefalse drops the attribute.
(input options)desc, placeholder, class, sizing, tip, required, disabled, readonly...

Example

Code

return form(['comment' => "Line one\nLine <two> & {braces}"])
    ->textarea('comment', ['rows' => 3])
    ->textarea('notes', 'Internal notes', ['rows' => 2, 'placeholder' => 'Only staff can see this']);

Notes

  • The text is escaped (<, & and template braces), so stored HTML shows as text.

Bootstrap 3 and 5

sizing applies under Bootstrap 5 always, under Bootstrap 3 only with CONF_SIZING_ON_SELECTS_ALL_FW.

See also: form/tinymce, html/textarea