Text area
Text areas allow users to enter multiple lines of alphanumeric data.
Also known as: input box, long text field, multi-line text box, multiline input, multiline textfield, text area, text box, text field
Text areas allow users to enter multiple lines of text for things like comments and notes.
<bolt-textarea label="Default text area"></bolt-textarea>
<bolt-textarea label="Default text area" showcount></bolt-textarea>
<bolt-textarea label="Text area with error" error="Error message goes here" showcount></bolt-textarea>
<bolt-textarea label="Field name" required invalid></bolt-textarea>
<bolt-textarea label="Disabled text area" disabled></bolt-textarea>
<bolt-textarea label="Non-required text area" optionaltext="hide"></bolt-textarea>
<bolt-textarea label="Textarea" cols="40" rows="3"></bolt-textarea>
Help text body content
<bolt-textarea label="Default text area">
<bolt-contextual-help slot="help" heading="Help text heading">
<p>Help text body content</p>
</bolt-contextual-help>
</bolt-textarea>
The <bolt-textarea> custom element creates a text area with a label and optional error text and character count:
<bolt-textarea label="Comments" showcount></bolt-textarea>
The <bolt-textarea> element should not be used to display a read-only scrollable field of text such as a legal agreement.
The <bolt-textarea> element must include one of these three parameters:
label: The label text for the input.arialabel: optional. Sets thearia-labelattribute of the underlying<textarea>element.arialabelledby: optional. Sets thearia-labelledbyattribute of the underlying<textarea>element.
Additionally, the <bolt-textarea> element supports the following parameters:
value: The value for the input.required: optional. If present, the field is required. Fields that are not required will show "(optional)".optionaltext: optional.show(default) orhide. Use to remove the "(optional)" text from non-required fields.rows: optional, defaults to 4. The number of rows on thetextarea.cols: optional. Specifies the width of thetextareain terms of average character widths. If not present, it will span the full width of its container.disabled: optional. If present, disables rendered interactive elements.error: The error message to display after the input.- Should not be used when component is
disabled. For slotted field error see textarea error slot
- Should not be used when component is
showcount: optional. If present, the remaining character count (based onmaxlength) will be displayed.maxlength: optional, defaults to 250. The maximum number of characters allowed in the text area.invalid: optional. If present, the field appears invalid.datatesttextareaoptional property to configure thedata-testvalue on the underlying<textarea>element. Default istextarea.
The <bolt-textarea> element supports the use of <bolt-contextual-help> via the help slot placeholder. For more information and to see other options visit the contextual help page.
The following attributes are passed through to the native <textarea> element. Please see the MDN Textarea element documentation for details.
spellcheck: optional. Defaults tofalse.autocomplete: optional. Defaults tooff. Please see possible values.autocorrect: optional. Defaults toon.autocapitalize: optional. Defaults toon.inputmode: optional, see standard behavior
Internals
Permalink to "Internals"Test selectors
Permalink to "Test selectors"[data-test="textarea"]- targets primary <textarea> element- Configurable via the
datatesttextareaproperty
- Configurable via the
General guidelines
Permalink to "General guidelines"- A character counter should be displayed if the number of characters users may enter is restricted.
- If a screen includes a Text area, using the Enter key on a keyboard (physical or virtual) should not trigger the same action as a Primary Button, such as a submit Button. Allow users to use the Enter key to add a line break while typing inside a Text area.
- Text area inputs can be configured to resize manually or have a fixed height or width.
Desktop
Permalink to "Desktop"- The dimensions of a Text area should allow for minimal vertical scrolling inside the Text area, given the allowed number of characters users can enter.
Mobile
Permalink to "Mobile"- The dimensions of a Text area should not require vertical scrolling of the screen if a virtual keyboard is displayed.
When to use
Permalink to "When to use"- A Text area is ideal for use when a user needs to enter more characters than would fit inside a traditional Text field.
When to use something else
Permalink to "When to use something else"- Avoid using the Text area element when the expected input can fit within a single line; use a Text field instead.
Do
- Allow Text area widths to be proportional to content.
- Align Text areas to grid columns.
- Use instructional text to show hints, formatting, and requirements.
- Use Text area when collecting longer text-based information from users.
- Use a field label with Text area for context and accessibility.
- Display a character counter if limiting the number of characters in a Text area.
Don't
- Avoid making text inputs excessively wide just to fill space.
- Don't use a Text area when the expected input can fit within a single line.
- Don't introduce horizontal scrolling functionality within the input area.
- Don't use placeholder text, especially not as a replacement for a label. This creates accessibility issues.
Content guidelines
Permalink to "Content guidelines"- Text area labels should use sentence case.
Accessibility compliance
Permalink to "Accessibility compliance"-
WCAG 2.2 Compliant
-
JAWS 2025 Tested
-
NVDA 2025 Tested
-
VoiceOver Tested
-
Keyboard Tested
-
aXe Tested
All Bolt components have gone through accessibility testing, but please keep our accessibility guidelines in mind.