跳到主要内容

Text area input

What is Text Area Input?

The Text area input component is a user interface element that allows users to enter and edit the the text area in a form or input field.

Properties

PropertiesDescription
Default valueThe initial value of the component. You can dynamically change the initial value by typing JavaScript in {{}}.
PlaceholderThe value will be shown when the input field is empty.
LabelThe name of the field displayed to the user
CaptionA caption used to describe the field in detail
Hidden labelSet whether to display the label
PositionSet the position of the label relative to the component
AlignmentSet the alignment (align to left or right) of the label
WidthWhen the label is on the left side of the component, set the width ratio of the label.
Event HandlerTrigger queries, control components, or call other APIs in response to component events.
DisabledControl the status of whether the component is disabled. The component cannot be modified or focused when it is disabled.
Read OnlyControl the status of whether the component is read-only. A read-only component can be selected and focused but cannot be modified.
Show clear buttoncontrol whether or not a clear button is displayed in the input field
Show character countcontrol whether or not the character count of the input is displayed
TooltipUsers can enter the component tooltip here. The tooltip will be shown when it is focused. Markdown format is supported.
Required fieldValid only when the switch is on.
Regexspecify a regular expression pattern that the input value must match
Max lengthset the maximum number of characters that can be entered into the input field.
Min Lengthspecify the minimum number of characters that the user must enter into the input field in order for the input to be considered valid.
Custom ruleCreate your validation logic here. The rules should be made in JavaScript and covered by {{}}.
Hide validation messageYou can hide the error message by switching the hidden status when the input value is incorrect. You can dynamically change the hidden status by JavaScript.
Form Data KeySpecify a key of a wrapping form component when constructing the data attribute.
Heightspecify the vertical size or height of the input field
HiddenDynamically control whether the component is hidden. You can change the hidden status through dynamical boolean value.
Theme ColorAllows users to specify the button's background color and opacity

Method

You can use other components to control the component. We support the following two methods:

  • setValue

To set the text area input value, for example, {{'value1'}}

PropertiesDescription
ValueInput value
  • clearValue

To clear the value of the selected component

  • focus

When the focus method is called, the text area input field will be highlighted and ready for the user to start typing without the need for the user to click on the number input field

Event handler

EventDescription
ChangeWhen a user changes the input value
FocusWhen a user moves the mouse cursor on the input component
BlurWhen a user is done inputting value and quit focusing on component

Data

The component has some commonly used data, which can be called via {{componentName.propertyName}} in the app.

Property nameDescription
valueuser input value
colorSchemebackground color of the button
customRuleuser-defined rule or validation logic that can be applied to the number input component
disableda Boolean value indicate the disabled status
displayNamethe name of this component (ie button1)
dynamicHeightallows the height of the text area to adjust dynamically based on the content entered by the user.
eventsgenerated or triggered when certain actions or events occur
formDataKeythe Form Data Key of input
hiddenhidden status (true or false)
labellabel value
labelAlignalignment of input label (left or right)
labelPositionposition of input label (left or right)
labelWidththe integer representing width of label.
maxLengththe value of maximum length
minLengththe value of minimum length
placeholderplaceholder value
readOnlya Boolean value indicate the readyOnly status of input.
requireda Boolean value indicate the required status of input.
resizeDirectionallows you to control the resizing behavior of the text area
regexapply pattern-based validation to the input text in the text area
tooltipTextvalue of tooltip text

Example: {{textarea1.value}}

Use case

Next, we will demonstrate how to map the data from the data source to the Text area input with a button.

Step 1 Add an action

Let us create a table in Supabase called Project. There are two attributes in Project: id and name. The name is the value we want to map to our text area input.

Then we can create a new action for Supabase from the action list, listing all the data in project and names as supabasedb2.

Click Save and Run to activate this action.

text_area_data

Step 2 Add Components

Next, we can add a text area input component and a button component to the canvas.

We set the default value of text area to be 'None' and labeled the button as 'Set value' as shown below

text_area_look

Step 3 Configure the component

For the button component, we can configure it to set the value in text area input component to the data of the document we read from supabasedb2.

  1. In the Edit event handler, select Control component in action, and select the textarea1 component that you want to update as the target of the event.
  2. Choose the setValue action and set the value as {{s31.data}}

text_area_config

Step 4 Test

Now that when you click the 'Set value' button, the value should change to the names.

text_area_test