Number input

Updated at:

Introduction

The number input is a common form component. You can use it to obtain a standard numerical value.

image

Configuration items

Category

Configuration

Example

Description

Content

Default value

The default value of the component.

Placeholder content

The placeholder content.

Maximum value

The maximum value allowed for input.

Minimum value

The minimum value allowed for input.

Step size

The amount to change the value by each step. This can be a decimal.

Label

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

Extension configuration

The prefix text, suffix text, prefix icon, decimal point (custom decimal point), and numerical precision (number of decimal places to display) for the component.

Interaction

Hidden

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

Disabled

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

Validation

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

Style

Margin

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

Variants

The different style variants of the input box. Different variants have different CSS styles.

CSS style

Border radius

The border radius of the component.

Font size

The font size of the component.

Background color

The background color of the component.

Border color

The border color of the component.

Active background color

The background color of the component in its active state.

Active border color

The border color of the component in its active state.

Active shadow

image

The shadow of the component in its active state.

Hover background color

The background color of the component in its hover state.

Hover border color

The border color of the component in its hover state.

Background color for prefix and suffix text

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

Label font size

The font size of the component label.

Properties and methods

Name

Type

Example

Description

value

string

inputNumber.value

The current input content.

labelText

string

inputNumber.labelText

The label text.

disabled

boolean

inputNumber.disabled

Indicates if the component is disabled.

max

number

inputNumber.max

The maximum number limit for the component.

min

number

inputNumber.min

The minimum number limit for the component.

placeholder

string

inputNumber.placeholder

The placeholder content.

addonBefore

string

inputNumber.addonBefore

The prefix text inside the component.

addonAfter

string

inputNumber.addonAfter

The suffix text inside the component.

hidden

boolean

inputNumber.hidden

Indicates if the component is hidden.

validationStatus

boolean

inputNumber.validationStatus

The status after validation.

validationMessage

string

inputNumber.validationMessage

The message after validation.

blur

func

inputNumber.blur()

Removes focus from the component.

focus

func

inputNumber.focus()

The component gains focus.

validate

func

inputNumber.validate()

Validates the component.

setValue

func

inputNumber.setValue('')

Sets the content of the component.

setDisabled

func

inputNumber.setDisabled(true)

Sets the disabled state of the component.

setHidden

func

inputNumber.setHidden(true)

Sets the hidden state of the component.

clearValue

func

inputNumber.clearValue()

Clears the value of the component.

clearHidden

func

inputNumber.clearHidden()

Clears the hidden value of the component.

clearValidate

func

inputNumber.clearValidate()

Clears the validation message of the component.

Event callbacks

Configuration

Description

The event that triggers after the component's value changes.

The event that triggers after the component gains focus.

The event that triggers after the component loses focus.

Scenario examples

  • Form scenario

    • Configuration: Set Maximum value to 100 and Minimum value to 1.

    • With this configuration, the number input only accepts numbers from 1 to 100.