A text area lets a user input a longer amount of text than a standard text field. It can include all of the standard validation options supported by the text field component.
Examples
$refs.firstTab.focus())"
>
Options
Label
A text area should always have a label. In rare cases where context is sufficient and the UX Team have reviewed the design, the label could be undefined. A text area without a visible label should still include an aria-label in HTML (depending on the context, “aria-label” or “aria-labelledby”).
Label Position
Labels can be placed either on top or on the side of the field. Top labels are the default recommendation because they work better with longer copy, localization, and responsive layouts. Side labels are most useful when vertical space is limited.
Value
The value shows a user’s entered text.
Width
The width of a text area can be customized appropriately for its context.
Size
Text areas come in three different sizes: small, medium and large. The medium size is the default and most frequently used option. Use the other sizes sparingly; they should be used to create a hierarchy of importance within the page.
Optional
Text areas can be marked as optional, depending on the situation. Optional text areas are either denoted with text added to the end of the label — “(optional)” — or have no indication at all.
Character Count
Text areas can display a character count indicator when the length of the text entry needs to be kept under a predefined value. Character count indicators can be used in conjunction with other indicators (e.g. “optional” indicators) when necessary.
Error
A text area can be marked as having an error to show that a value needs to be entered in order to move forward or that a value that was entered is invalid. If an error exists, the error icon always overrides any other icon.
Disabled
A text area in a disabled state shows that the input field exists, but is not available in that circumstance. This can be used to maintain layout continuity and communicate that a text area may become available later.
Read Only
Text areas have a read-only option for when content in the disabled state still needs to be shown. This allows for content to be copied, but not interacted with or changed. A text area does not have a read-only option if there is nothing entered in it.
Fixed
Text areas can either be a static size or can be resizable with a drag icon in the bottom right corner. Text areas are resizable by default. The drag icon should be hidden if the text area should not be resizable.
Help Text
A text area can have help text below the field to give extra context or instruction about what a user should input in the field. The help text area has two options: a description and an error message. The description communicates a hint or helpful information, such as specific requirements for correctly filling out the field. The error message communicates an error for when the field requirements aren’t met, prompting a user to adjust what they had originally input.
Behaviors
Minimum Size
Text areas are ideal for long sentences or paragraphs, and should comfortably accommodate larger amounts of text. They should have a minimum height of 3rem (when the height of the text area is a defined number). The minimum width is 7rem.
Overflow
Work In Progress
When typing into a text area and reaching the end of the field on a number-height text area, the cursor should remain as static in the bottom right corner (for left-to-right languages) while text above it overflows through the top of the field. When the field loses focus, text should overflow through the bottom of the text area, showing the beginning of the text.
Help Text Overflow
When the help text is too long for the available horizontal space, it wraps to form another line.
$refs.secondTab.focus())"
>
Implementation
Example Name
Description and implementation notes
<p> code example </p>
$refs.thirdTab.focus())"
>
Information
Checklist
All interactive states
Includes all interactive states that are applicable (hover, down, focus, keyboard disabled).
All Color Schemes
Works properly across all color schemes (light, dark).
Accessible Contrast for Text
Text has a contrast ratio of at least 4.5:1 for small text and at least 3:1 for large text (WCAG 2.0 1.4.3).
Accessible Contrast for UI Components
Visual information required to identify components and states (except inactive components) has a contrast ratio of at least 3:1 (WCAG 2.1 1.4.11).