TextAreaField
The TextAreaField component provides a customizable text area field that can be used to collect user information, such as comments, feedback, or other types of data.
It is a wrapper around the native <textarea /> element, and includes an optional label and validation alert. The label and textarea are automatically associated for screen readers.
Usage Guidelines
States
Default
The default state of the text field is used to indicate that the user has not yet entered any information.
<TextAreaField description="Tell us what you really think" isRequired label="Comments"/>Disabled
The disabled state of the text field is used to indicate that the user cannot interact with the field.
<TextAreaField description="Tell us what you really think" isDisabled isRequired label="Comments"/>Read-only
The read-only state of the text field is used to make the text field non-editable.
<TextAreaField description="Tell us what you really think" isReadOnly isRequired label="Comments" placeholder="In my opinion..." validationMessage="Hmm. Your comment is okay." validationState="success"/>Validation
Error
In the case of an error when validating a field, the validationState prop should be set to error and the validationMessage prop should be set to the error message.
<TextAreaField description="Tell us what you really think" isRequired label="Comments" placeholder="In my opinion..." validationMessage="Hmm. Your comment is not okay." validationState="error"/>Success
In the case of success when validating a field, the validationState prop should be set to success and the validationMessage prop should be set to the success message.
<TextAreaField description="Tell us what you really think" isRequired label="Comments" placeholder="In my opinion..." validationMessage="Hmm. That makes sense." validationState="success"/>Warning
In the case of a warning when validating a field, the validationState prop should be set to warning and the validationMessage prop should be set to the warning message.
<TextAreaField description="Tell us what you really think" isRequired label="Comments" placeholder="In my opinion..." validationMessage="Hmm. Not sure about that." validationState="warning"/>Props
The label for the textarea.
Shows a description under the label.
Controls if the textarea is disabled.
Shows a placeholder in the textarea.
Height of textarea based on number of visible rows.
Show a validation message under the textarea.
Changes the appearance of the textarea.
Whether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA.
An enumerated attribute that defines what action label or icon to preset for the enter key on virtual keyboards. See MDN.
Whether the input can be selected but not changed by the user.
Whether user input is required on the input before form submission.
A function that returns an error message if a given value is invalid.
Validation errors are displayed to the user when the form is submitted
if validationBehavior="native". For realtime validation, use the isInvalid
prop instead.
Whether the element should receive focus on render.
Handler that is called when the element receives focus.
Handler that is called when the element loses focus.
Handler that is called when the element's focus status changes.
Handler that is called when a key is pressed.
Handler that is called when a key is released.
The current value (controlled).
The default value (uncontrolled).
Handler that is called when the value changes.
Whether to exclude the element from the sequential tab order. If true, the element will not be focusable via the keyboard by tabbing. This should be avoided except in rare scenarios where an alternative means of accessing the element or its functionality via the keyboard is available.
The element's unique identifier. See MDN.
Describes the type of autocomplete functionality the input should provide if any. See MDN.
The maximum number of characters supported by the input. See MDN.
The minimum number of characters required by the input. See MDN.
Regex pattern that the value of the input must match to be valid. See MDN.
An attribute that takes as its value a space-separated string that describes what, if any, type of autocomplete functionality the input should provide. See MDN.
An enumerated attribute that defines whether the element may be checked for spelling errors. See MDN.
The name of the input element, used when submitting an HTML form. See MDN.
The <form> element to associate the input with.
The value of this attribute must be the id of a <form> in the same document.
See MDN.
Handler that is called when the user copies text. See MDN.
Handler that is called when the user cuts text. See MDN.
Handler that is called when the user pastes text. See MDN.
Handler that is called when a text composition system starts a new text composition session. See MDN.
Handler that is called when a text composition system completes or cancels the current text composition session. See MDN.
Handler that is called when a new character is received in the current text composition session. See MDN.
Handler that is called when text in the input is selected. See MDN.
Handler that is called when the input value is about to be modified. See MDN.
Handler that is called when the input value is modified. See MDN.
The inline style for the element. A function may be provided to compute the style based on component state.
The CSS className for the element. A function may be provided to compute the class based on component state.
The children of the component. A function may be provided to alter the children based on component state.
A slot name for the component. Slots allow the component to receive props from a parent component.
An explicit null value indicates that the local props completely override all props received from a parent.