Forms / Number field

Forms

Number field

An editable figure in tabular figures, with optional steppers and a unit inside the box.

import { EcoNumberField } from "vue-ecosphere"

Number

A text input with inputmode=numeric (decimal for a fractional step), never type=number.

Whole units only.

Value: 12

Stepper

Value: 8

With a unit

Step down to 5 and the down button disables. Type 900 and leave the field: it becomes 300.

sec

Between 5 and 300 seconds.

Decimal

A fractional step switches the touch keypad to inputmode=decimal, so the point can be typed.

/ 50

Half marks allowed.

Value: 37.5

Out of range

Step below 11 to clear the error.

Ten retries is the most this plan allows.

API

NameTypeDefaultDescription
v-modelnumber | nullnullThe figure; null while the box is empty or holds text that is not a number (the input is then aria-invalid).
stepperbooleanfalseUp/down buttons, only where a person nudges the value. ArrowUp/ArrowDown step too.
min / maxnumber—Bounds. A stepper disables at the end of its range, and a typed figure outside them is pulled back to the nearest bound when the field is left.
stepnumber1Stepper increment. A fractional step brings up the decimal keypad (inputmode=decimal).
inputmodestring—Passed to the input and wins over the default (numeric, or decimal for a fractional step).
unitstring—Unit inside the box (input__unit), never in the label.
label / required / hint / error / invalid / first——Field props. Say the range in the hint.
increaseLabel / decreaseLabelstring"Increase" / "Decrease"Stepper button names.