Intro
The text area is an input control that allows the user to enter multiple lines of text.
Usage
Use the text area if you want to enter multiple lines of text. If you only want to enter a single line of text, use the text control instead.
Responsiveness
You can set the maximum number of lines to be shown. The amount of text depends on the size of the screen. On smaller screens, the user can scroll down the text area to see the entire text. To indicate that the text continues, the control shows only half of the last line. This also applies for mobile devices.
Components
Text area – Default
Text area – Active state
Text area – With placeholder (input prompt)
Behavior and Interaction
Entering and Removing Text
The user can enter text. As soon as the user starts typing, the placeholder disappears. It appears again when the user removes all the content from the text area.
You can also limit the number of characters a user can enter. In this case, the text area prevents the user from adding more characters than the maximum value defined (property: maxLength).
Text area – Limited
Making Text Non-Editable
Text area – Not editable
Disabling Text
Text area – Not enabled
Text area – Not enabled (long text)
Styles
As with any other input control, you can validate the fields and show the result as a value state (property: valueState) of the control (such as error, warning, success, or none).
For more information, see form field validation.
Text area – Error state
Guidelines
- As with other input fields in general, use a label. For exceptions regarding label usage, see the Exceptions section of the label article.
- The placeholder does not substitute a label. It can be used to give an additional hint, but should not repeat the label in long format.
- If you want to use the text area with a fixed text length (property: maxLength), for example, inside a form, use text beside the text area to indicate the number of remaining characters and a countdown while the user is typing.
Properties
- You can provide a width by using the average character width (property: cols).
- You can define the height of the text area via the lines of text (property: rows). You can also set the height of the text area (property: height), which would override the rows property.
- Additionally, you can define the type of wrapping for the text area (property: wrapping) as Soft, Hard, or Off.
Resources
Want to dive deeper? Follow the links below to find out more about related controls, the SAPUI5 implementation, and the visual design.