Skip to main content

Textarea

The Textarea component allows users to enter text in an input field similar to the Text Input component. Textarea is generally preferred when we are expecting an input of multiple sentences. In this document, we'll go through all the configuration options for the Textarea component.

Properties

PropertyDescriptionExpected Value
LabelText to display as the label for the field.String (for e.g., Enter Your Address).
Default valueUsed to set initial value in text area on load.String (for e.g., Nexus Building, Street XYZ, AB, 010101).
PlaceholderProvides a hint for the expected value. It disappears once the user interacts with the component.String (for e.g., Enter Your Address Here).

Events

EventDescription
On changeTriggers whenever the input value changes.
On enter pressedTriggers whenever the enter key is pressed.
On focusTriggers whenever the user clicks inside the input field.
On blurTriggers whenever the user clicks outside the input field.
info

Check Action Reference docs to get the detailed information about all the Actions.

Component Specific Actions (CSA)

Following actions of component can be controlled using the Component Specific Actions(CSA), which can be triggered by an event or by the given RunJS query:

Actions
Description
How To Access
setTextSets the text for the component.components.textarea1.setText('this is a textarea')
clearClears the value from the text area component.components.textarea1.clear().
setVisibility( )Sets the visibility state of the text area.components.textarea1.setVisibility()
setLoading( )Sets the loading state of the text area.components.textarea1.setLoading()
setDisable( )Disables the text area.components.textarea1.setDisable()
setFocus( )Sets the focus of the cursor on the text area.components.textarea1.setLoading()
setBlur( )Removes the focus of the cursor from the text area.components.textarea1.setBlur()

Exposed Variables

Following exposed variables can be dynamically accessed using the given JS query:

VariablesDescriptionHow To Access
valueThis variable holds the value entered in the text area component.{{components.textarea1.value}}
labelHolds the value of the component's label.{{components.textarea1.label}}
isValidIndicates if the input meets validation criteria.{{components.textarea1.isValid}})
isMandatoryIndicates if the field is Mandatory.{{components.textarea1.isMandatory}}
isLoadingIndicates if the component is loading.{{components.textarea1.isLoading}}
isVisibleIndicates if the component is visible.{{components.textarea1.isVisible}}
isDisabledIndicates if the component is disabled.{{components.textarea1.isDisabled}}

Validation

Validation Option
Description
Expected Value
Make this field mandatoryDisplays a 'Field cannot be empty' message if no value is entered.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
RegexRegular Expression to validate the input.Regular Expression Pattern (e.g., ^\d{3}-\d{2}-\d{4}$).
Min lengthSets the minimum number of characters allowed.Integer (e.g., 100 for a minimum of 100 characters).
Max lengthSets the maximum number of characters allowed.Integer (e.g., 500 for a maximum of 500 characters).
Custom validationSpecifies a validation error message for specific conditions.Logical Expression (e.g., {{components.textarea1.value<5&&"Value needs to be more than 5"}}).

To add regex inside Custom Validation, you can use the below format:

Format: {{(<regexPattern>.test(<value>)) ? '' : 'Error message';}}

Example: {{(/^\d{1,10}$/.test(components.textarea1.value)) ? '' : 'Error message';}}

Additional Actions

Action
Description
Configuration Options
Dynamic heightAutomatically adjusts the component's height based on its content.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
Loading stateEnables a loading spinner, often used with isLoading to indicate progress.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
VisibilityControls component visibility.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
DisableEnables or disables the component.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
TooltipProvides additional information on hover. Set a string value for display.String (e.g., Enter your name here. ).

Devices

Property
Description
Expected Value
Show on desktopMakes the component visible in desktop view.You can set it with the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
Show on mobileMakes the component visible in mobile view.You can set it with the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.

Styles

Label

PropertyDescription
Label ColorSets the color of the label text.
AlignmentDetermines the label's position, choose between top/side and left/right alignment.
WidthSpecifies the percentage of the component’s width that the label should occupy.

Color

PropertyDescription
BackgroundSets the background color of the component.
BorderDefines the color of the component’s border.
AccentSpecifies the accent color used for highlights or focus indicators.
TextSets the text color inside the component.
Error textColor applied to error messages.

Input Field

PropertyDescription
IconAdds an icon to the component, usually for visual cues or actions.
Icon ColorSets the color of the icon.
Border radiusControls the roundness of the component's input field.
Box shadowApplies shadow styling to the input field.
PaddingSets the internal spacing between the content and the input field edges.
info

Any property having fx button next to its field can be programmatically configured.