Overview
The textarea allows you to interact with a multi-line string:Resizing the textarea
You may change the size of the textarea by defining therows() and cols() methods:
Autosizing the textarea
You may allow the textarea to automatically resize to fit its content by setting theautosize() method:
Making the field read-only
Not to be confused with disabling the field, you may make the field “read-only” using thereadOnly() method:
disabled():
- When using
readOnly(), the field will still be sent to the server when the form is submitted. It can be mutated with the browser console, or via JavaScript. You can usedehydrated(false)to prevent this. - There are no styling changes, such as less opacity, when using
readOnly(). - The field is still focusable when using
readOnly().
Disabling Grammarly checks
If the user has Grammarly installed and you would like to prevent it from analyzing the contents of the textarea, you can use thedisableGrammarly() method:
Textarea validation
As well as all rules listed on the validation page, there are additional rules that are specific to textareas.Length validation
You may limit the length of the textarea by setting theminLength() and maxLength() methods. These methods add both frontend and backend validation:
length(). This method adds both frontend and backend validation: