Numeric Input

Input numerical values with a customizable range.

Basic usage

Bind a variable to v-model in <b-numeric-input> 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 0.

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.

Attributes

NameDescriptionTypeAccepted ValuesDefault
model-value / v-modelbinding valuenumber / undefined
minthe minimum allowed valuenumber-Infinity
maxthe maximum allowed valuenumberInfinity
stepincremental stepnumber1
step-strictlywhether input value can only be multiple of stepbooleanfalse
precisionprecision of input valuenumber
sizesize of the componentstringlarge / default / smalldefault
readonlysame as readonly in native inputbooleanfalse
disabledwhether the component is disabledbooleanfalse
controlswhether to enable the control buttonsbooleantrue
controls-positionposition of the control buttonsstringright-
namesame as name in native inputstring
labellabel textstring
placeholderplaceholder in inputstring--
value-on-clearvalue should be set when input box is clearedstring / number / nullmin / max-
validate-eventwhether to trigger form validationboolean-true

Events

NameDescriptionParameters
changetriggers when the value changes(currentValue: number | NaN, oldValue: number | NaN)
blurtriggers when Input blurs(event: FocusEvent)
focustriggers when Input focuses(event: FocusEvent)

Methods

MethodDescriptionParameters
focusget focus the input component-
blurremove focus the input component
Last Updated:
Contributors: Tam Mai