Skip to main content

Input

What is Input?

Text Input component is a user interface element that allows users to enter and edit text 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
Prefix texta short piece of text that appears to the left of the input field, often used to provide additional context or instructions to the user
Suffix texta short piece of text that appears to the right of the input field, often used to provide additional information or feedback to the user
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.
Patternspecify a regular expression pattern that the user's input must match in order to be considered valid
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.
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 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 input field will be highlighted and ready for the user to start typing without the need for the user to click on the input field

Example Usage:

Input component support listening to the onChange event of other components using built-in event system. Set it up by following these example steps:

  1. Add an event trigger to the component that you want to listen to. For example, if you want to listen to the onChange event of a Radio Group component, you would add an event handler to that Radio Group component.
  2. In the Edit event handler, select Control component in action, select the Input component that you want to update as the target of the event.
  3. Choose the SetValue action and select the appropriate value for the input component. This will be the value that the input component has and will update when the event is triggered.
  4. Save the event trigger settings and repeat the process for any other components that you want to listen to.

Once you've set up the event triggers, the input component will automatically update whenever the onChange event is triggered on the other components. This allows you to create dynamic interfaces that respond to user input in real-time, making it easier for users to navigate and interact with your application.

Event handler

EventDescription
ChangeWhen a user changes the selected input value
FocusWhen a user moves the mouse cursor on the input component
BlurWhen a user is done inputting value and quit from focusing on the cascader 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
disableda Boolean value indicate the disabled status
displayNamethe name of this component (ie button1)
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
prefixTextvalue of the text prefix
suffixTextvalue of the text suffix
readOnlya Boolean value indicate the readyOnly status of input.
requireda Boolean value indicate the required status of input.
regexregular expression of input
showCharacterCounta Boolean value indicate whether the character count of input is displayed
tooltipTextvalue of tooltip text

Example: {{input1.value}}

Use case

Below are some examples for customizing input component.

  • Prefix:

input_prefix

  • Suffix:

input_suffix

  • Tooltip:

input_tooltip

  • Pattern:

input_pattern