Textareas
The textarea element represents a multi-line plain-text editing control, useful when you want to allow users to enter a sizeable amount of free-form text, for example, a comment on a review or feedback form.
Text field with helper text 1/10
Variations
Basic Text Area
Copy as:
Basic Text Area Base Size:
copydone
Text field with helper text 1/10
copydone Text field with helper text 1/10
copydone Text field with helper text 1/10
copydoneBasic Text Area Large Size:
copydone
Text field with helper text 1/10
copydone Text field with helper text 1/10
copydoneText field with helper text 1/10
copydoneOutlined Text Area
Copy as:
Outlined Text Area Base Size:
copydone
Text field with helper text 1/10
copydone Text field with helper text 1/10
copydone Text field with helper text 1/10
copydoneOutlined Text Area Large Size:
copydone
Text field with helper text 1/10
copydone Text field with helper text 1/10
copydone Text field with helper text 1/10
copydoneUsage
The <textarea>
element defines a multi-line text input control. It's often used in a form, to collect user inputs like comments or reviews. A text area can hold an unlimited number of characters.
Specs
Textareas comes in two basic styles (base and outlined) and 2 sizes:
- Base: text font size of 0.875rem (14px) and a label that scales from 0.875rem (14px) in font size, when the textarea is empty or 0.75rem (12px) when the label is floated. Helper text is also 0.75rem (12px) and a top and bottom margin of 1.5rem (24px) is used to house both the floating label and the helper text.
- Large: text font size of 1rem (16px) and a label that scales from 1rem (16px) in font size, when the textarea is empty or 0.75rem (12px) when the label is floated. Helper text is also 0.75rem (12px) and a top and bottom margin of 1.5rem (24px) is used to house both the floating label and the helper text.
Accessibility notes
For better accessibility when using the <textarea>
element:
- An id attribute to allow the
<textarea>
to be associated with a<label>
element for accessibility purposes. - A name attribute to set the name of the associated data point submitted to the server when the form is submitted.
- Rows and cols attribute to allow you to specify an exact size for the
<textarea>
to take. - Default content is entered between the opening and closing tags.