Skip to main content

Textarea

The Textarea component can be used in any form to provide a multi-line text input field. It has similar properties to the Text component, including configuration options for being readonly, disabled, required, and supporting placeholder, helper text, and default value.

Configuration Schema

The JSON schema defines the structure for the Textarea component, outlining the options for customization:

[
{
"name": "comments",
"meta": {
"displayName": "Comments",
"displayType": "textarea",
"placeholder": "Enter your comments",
"description": "Please provide your feedback",
"readOnly": false,
"validation": {
"required": true,
"requiredDetail": {
"errorMsg": "custom message for required detail"
},
"minLength": 10,
"maxLength": 300
},
"htmlProps": {
"minRows": 4,
"maxRows": 4
}
}
}
]

Basic Configuration

Please provide your feedback

Form Data:
{}

Field Properties

Properties used by this field (inside meta field in schema)

NameDescriptionType
displayNameThe label shown above the textarea fieldstring
displayTypeThe type of the field to be displayedstring
placeholderThe hint shown in the textarea fieldstring
requiredIndicates whether the field is mandatoryboolean
minLengthSpecifies the minimum number of characters allowed in the inputnumber
maxLengthSpecifies the maximum number of characters allowed in the inputnumber
patternA regex pattern that the field value must matchstring
validateA function for custom validation logicfunction
descriptionHelper text or additional description shown below the textarea fieldstring
readOnlyA readonly field is not editable and value cannot be changedboolean
htmlPropsAdditional HTML properties that can be passed to the textareaobject

Field Properties - Validation Details

The validation settings within the Textarea component are crucial for ensuring that user input meets specific requirements. Here’s a breakdown of the available validation properties:

PropertyDescription
requiredBoolean value that specifies whether entering data into the field is mandatory.
minLengthSpecifies the minimum number of characters allowed in the input.
maxLengthSpecifies the maximum number of characters allowed in the input.
minSpecifies the minimum value allowed for number inputs, with support for dynamic values.
maxSpecifies the maximum value allowed for number inputs, also supporting dynamic conditions.
patternA regex pattern that the input must match to be considered valid.
validateA function for custom validation logic, which can return a boolean or an error message.
requiredDetailContains info msgs about the required validation property

Example Usage of Validation Properties

{
"name": "comments",
"meta": {
"displayName": "Comments",
"displayType": "textarea",
"readOnly": false,
"validation": {
"required": true,
"minLength": 10,
"maxLength": 300,
"min": 10,
"max": 300,
"pattern": "/^[a-zA-Z0-9 .,'-]+$/"
},
"htmlProps": {
"minRows": 3,
"maxRows": 6
}
}
}