type
- |
-string
- |
-text
- |
-No
- |
-Type of the input component. Available values include text, email, date, time, number, password, button, checkbox, and radio.
-The text, email, date, time, number, and password types can be dynamically switched and modified.
-The button, checkbox, and radio types cannot be dynamically modified. Available values include:
-- button: a button that can be clicked
- checkbox: a check box
- radio: a radio button that allows users to select one from multiple others with the same name
- text: a single-line text field
- email: a field used for an email address
- date: date control, including the year, month, and day, but excluding time
- time: time control, without the time zone
- number: field for entering digits
- password: password field, in which characters will be shielded
NOTE: For wearables, only button, radio, and checkbox types are supported.
-
-
- |
-
-checked
- |
-boolean
- |
-false
- |
-No
- |
-Whether the <input> component is selected. This attribute is valid only when type is set to checkbox or radio.
- |
-
-name
- |
-string
- |
--
- |
-No
- |
-Name of the input component.
- |
-
-value
- |
-string
- |
--
- |
-No
- |
-Value of the input component. When type is radio, this attribute is mandatory and the value must be unique for radio buttons with the same name.
- |
-
-placeholder
- |
-string
- |
--
- |
-No
- |
-Content of the hint text. This attribute is available only when the component type is set to text, email, date, time, number, or password.
- |
-
-maxlength
- |
-number
- |
--
- |
-No
- |
-Maximum number of characters that can be entered in the input box. If no value is specified, the number of characters is not limited.
- |
-
-enterkeytype
- |
-string
- |
-default
- |
-No
- |
-Dynamic modification is not supported.
-Available values include:
-- default
- next
- go
- done
- send
- Search
- NOTE: The soft keyboard is automatically collapsed after you click the Enter button, except when next is displayed for the button.
-
- |
-
-headericon
- |
-string
- |
--
- |
-No
- |
-Icon resource path before text input. This icon does not support click events and is unavailable for button, checkbox, and radio types. The supported icon image formats are JPG, PNG, and SVG.
- |
-
-showcounter5+
- |
-boolean
- |
-false
- |
-No
- |
-Whether to display the character counter for an input box. This attribute takes effect only when maxlength is set.
- |
-
-menuoptions5+
- |
-Array<MenuOption>
- |
--
- |
-No
- |
-Menu options displayed after users touch the More button.
- |
-
-autofocus6+
- |
-boolean
- |
-false
- |
-No
- |
-Whether to automatically obtain the focus.
- NOTE: This attribute setting does not take effect on the application home page. You can enable a text box on the home page to automatically obtain focus, by delaying the focus method call (for about 100–500 ms) in onActive.
-
- |
-
-selectedstart6+
- |
-number
- |
--1
- |
-No
- |
-Start position for text selection.
- |
-
-selectedend6+
- |
-number
- |
--1
- |
-No
- |
-End position for text selection.
- |
-
-softkeyboardenabled6+
- |
-boolean
- |
-true
- |
-No
- |
-Whether to display the soft keyboard during editing.
- |
-
-showpasswordicon6+
- |
-boolean
- |
-true
- |
-No
- |
-Whether to display the icon at the end of the password text box. The setting is valid only when type is set to password.
- |
-
-
-