Input box

Updated at:

Introduction

The input box is a common component in forms. It allows users to enter content into a form field.

image

Configurations

Category

Configuration

Example

Description

Content

Default value

image

The default value of the component.

Placeholder content

image

The placeholder content.

Maximum length

image

The maximum number of characters allowed.

Password mode

image

Specifies whether to enable password mode.

Label

image

The form label. For more information, see General form properties.

Extension configuration

image

image

image

image

Settings for component prefixes and suffixes, such as text and icons.

Interaction

Hide

image

Hides the component. For more information, see General properties.

Disable

image

Disables the component. A disabled component cannot be clicked or selected.

Search

image

Specifies whether to display the search button.

Validation

image

Form validation. For more information, see General form properties.

Style

Margin

image

The outer margin. For more information, see General properties.

Clear button

image

Specifies whether to display the clear button.

Style variant

image

The style variants of the component. Different variants support different CSS styles.

CSS Style

Border radius

image

The border radius of the component.

Font size

image

The font size of the component.

Background color

image

The background color of the component.

Border color

image

The border color of the component.

Active background color

image

The background color of the component in the active state.

Active border color

image

The border color of the component in the active state.

Active shadow

image

The shadow of the component in the active state.

Hover background color

image

The background color of the component in the hover state.

Hover border color

image

The border color of the component in the hover state.

Prefix/suffix text background color

image

The background color for the prefix and suffix text of the component.

Label font size

image

The font size of the component label.

Properties and methods

Name

Type

Example

Description

value

string

input.value

The current input content.

labelText

string

input.labelText

The label text.

disabled

boolean

input.disabled

Specifies whether the component is disabled.

maxLength

number

input.maxLength

Placeholder content

isPassword

boolean

input.isPassword

Specifies whether the component is in password mode.

placeholder

string

input.placeholder

The hint text displayed when the content is empty.

addonBefore

string

input.addonBefore

The prefix text inside the component.

addonAfter

string

input.addonAfter

The suffix text inside the component.

showSearch

boolean

input.showSearch

Show Search

hidden

boolean

input.hidden

Specifies whether the component is hidden.

validationStatus

boolean

input.validationStatus

The validation status of the component.

validationMessage

string

input.validationMessage

The validation message of the component.

blur

func

input.blur()

Removes focus from the component.

focus

func

input.focus()

The component receives focus

validate

func

input.validate()

Validates the component.

setValue

func

input.setValue('')

Sets the content of the component.

setDisabled

func

input.setDisabled(true)

Sets the disabled state of the component.

setHidden

func

input.setHidden(true)

Sets the hidden state of the component.

clearValue

func

input.clearValue()

Clears the `value` of the component.

clearHidden

func

input.clearHidden()

Clears the `hidden` value of the component.

clearValidate

func

input.clearValidate()

Clears the validation state of the component.

Event callbacks

Configuration

Description

image

The event triggered after the component's value changes.

image

The event triggered after the component gains focus.

image

The event triggered after the component loses focus.

image

The event triggered after the Enter key is pressed within the component.

Scenario examples

  • Logon scenario

    • Configuration: Disable Password mode for the username and enable it for the password. Use Placeholder content to distinguish between the two fields.

    • This configuration creates a standard logon form with a username and password.

    • image

  • Form validation

    • Configuration: Drag a Form component onto the canvas, and then drag three input boxes into the form. For the first input box, enter "Mobile number" as the Label content. To add validation, click the icon on the right, add a Custom item, and then enter the regular expression as shown in the figure.

    • This configuration lets you validate input fields within the form.