The textarea field creates a textarea for longer texts with automatic resizing and optional format buttons.
||–||Sets the focus on this field when the form loads. Only the first field with this label gets|
||Enables/disables the format buttons. Can either be
||Enables/disables the character counter in the top right corner|
||–||Sets the default text when a new page/file/user is created|
||Sets the options for the files picker|
||–||Sets the font family (sans or monospace)|
|help||–||Optional help text below the field|
||–||Optional icon that will be shown at the end of the field|
|label||–||The field label can be set as string or associative array with translations|
||–||Maximum number of allowed characters|
||–||Minimum number of required characters|
|placeholder||–||Optional placeholder value that will be shown when the field is empty|
||–||Changes the size of the textarea. Available sizes:
||Sets the upload options for linked files (since 3.2.0)|
|when||–||Conditions when the field will be shown (since 3.1.0)|
||The width of the field in the field grid. Available widths:
In some section layouts, a small textarea looks lost. The
size option sets an initial default height for empty textareas before auto-sizing kicks in. Available sizes:
If the formatting toolbar should not be available, you can switch it off entirely:
You can also specify which buttons to show in the toolbar.
You can add your custom textarea buttons in a plugin.
The file upload and select button is super useful if you want to embed images or other files right in your text.
You can define the button behavior with the
By default all files will be uploaded to the current page and without a predefined template. With the additional options you can fetch files from anywhere and upload them to specific pages. You can also control which file template should be assigned by default:
You can also deactivate file uploads:
You can control the maximal and/or minimal length of the entered text by using the
minlength option. A handy indicator of the current text length will be displayed in the upper right corner.
You can set the
font option to
monospace, for example for fields that contain code:
The usual way to render the value of a textarea field is using the
kirbytext() method (or the shortcut
However, there might be situations, where you want to parse KirbyTags, but not render block level elements:
For more field manipulations, check out Kirby's field methods.