Input Number ​

Input numerical values with a customizable range.

Basic usage ​

Bind a variable to v-model in <el-input-number> element and you are set.

TIP

When inputting invalid string to the input box, input value will emit NaN to the upper layer as result of error

Disabled ​

The disabled attribute accepts a boolean, and if the value is true, the component is disabled. If you just need to control the value within a range, you can add min attribute to set the minimum value and max to set the maximum value. By default, the minimum value is Number.MIN_SAFE_INTEGER.

Steps ​

Allows you to define incremental steps.

Add step attribute to set the step.

Step strictly ​

The step-strictly attribute accepts a boolean. if this attribute is true, input value can only be multiple of step.

Precision ​

Add precision attribute to set the precision of input value.

TIP

The value of precision must be a non negative integer and should not be less than the decimal places of step.

Size ​

Use attribute size to set additional sizes with large or small.

Controls Position ​

Set controls-position to decide the position of control buttons.

Custom Icon 2.6.3 ​

Use decrease-icon and increase-icon to set custom icons.

With prefix and suffix 2.8.4 ​

Use the prefix and suffix named slots.

¥
RMB

TIP

For precision purposes, the input number is limited from Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER.

Formatter 2.14.0 ​

Display the value with formatter, and typically use parser alongside it.

When formatter is set, the inner input type changes to text, which allows non-numeric characters to be entered. Internally, the component processes input with Number.parseFloat: when parsing succeeds, the parsed number is written to model-value; when parsing returns NaN, model-value is set to null.

API ​

Attributes ​

NameDescriptionTypeDefault
model-value / v-modelbinding valuenumber / null—
minthe minimum allowed valuenumberNumber.MIN_SAFE_INTEGER
maxthe maximum allowed valuenumberNumber.MAX_SAFE_INTEGER
stepincremental stepnumber1
step-strictlywhether input value can only be multiple of stepbooleanfalse
precisionprecision of input valuenumber—
sizesize of the componentenumdefault
readonly 2.2.16same as readonly in native inputbooleanfalse
disabledwhether the component is disabledbooleanfalse
controlswhether to enable the control buttonsbooleantrue
controls-positionposition of the control buttonsenum—
namesame as name in native inputstring—
aria-label a11y 2.7.2same as aria-label in native inputstring—
placeholdersame as placeholder in native inputstring—
idsame as id in native inputstring—
value-on-clear 2.2.0value should be set when input box is clearednumber / null / enum—
validate-eventwhether to trigger form validationbooleantrue
label a11y deprecatedsame as aria-label in native inputstring—
inputmode 2.10.3same as inputmode in native inputstring—
align 2.10.5alignment for the inner input textenum'center'
disabled-scientific 2.10.5disables input of scientific notation (e.g. 'e')booleanfalse
tabindex 2.14.0same as tabindex in native inputstring / number0
formatter 2.14.0specifies the format of the value presented in the inputFunction—
parser 2.14.0specifies the value extracted from the formatted inputFunction—

Slots ​

NameDescription
decrease-icon 2.6.3custom input box button decrease icon
increase-icon 2.6.3custom input box button increase icon
prefix 2.8.4content as Input prefix
suffix 2.8.4content as Input suffix

Events ​

NameDescriptionType
changetriggers when the value changesFunction
blurtriggers when Input blursFunction
focustriggers when Input focusesFunction

Exposes ​

NameDescriptionType
focusget focus the input componentFunction
blurremove focus the input componentFunction

Source ​

Component • Style • Docs

Contributors ​