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
| Name | Type | Default | Description |
|---|---|---|---|
v-model | number | null | null | The figure; null while the box is empty or holds text that is not a number (the input is then aria-invalid). |
stepper | boolean | false | Up/down buttons, only where a person nudges the value. ArrowUp/ArrowDown step too. |
min / max | number | — | 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. |
step | number | 1 | Stepper increment. A fractional step brings up the decimal keypad (inputmode=decimal). |
inputmode | string | — | Passed to the input and wins over the default (numeric, or decimal for a fractional step). |
unit | string | — | 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 / decreaseLabel | string | "Increase" / "Decrease" | Stepper button names. |