Skip to content
Calm motion: animations on this site only fade, with no movement

InputNumber ​

Number with ± steppers and Intl format

For amounts, quantities and prices: values you count or add up. Something that is merely made of digits (a phone number, a postcode, a card number) is not a number. Use InputMask or Input.

Basic
税込
  • format (any Intl.NumberFormat options) applies while the field is not focused. On focus you edit the plain number, with the locale's decimal mark (1,5 in de-DE).
  • step counts from min, as in HTML: min=5 step=10 gives 5, 15, 25. The value snaps to a step on blur.
  • Keys: ↑/↓ one step, Page Up/Down ten, Home/End to min/max when set. Screen readers hear the formatted value with prefix and suffix.
  • Money needs no separate component. Use :format="{ style: 'currency', currency: 'USD' }" with a locale. The Intl options set the symbol, the decimals, and the grouping.
  • name submits the plain number with the form (1980), not the formatted text (¥1,980).
  • :buttons="false" when the steppers make no sense, like a large price.

Usage ​

ts
import { BlessInputNumber } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
idstring—
namestring—submitted with the form as the plain number, not the formatted text
minnumber—
maxnumber—
stepnumber1
buttonsbooleantrue± buttons
prefixstring—
suffixstring—
formatIntl.NumberFormatOptions—Intl.NumberFormat options used while not focused
localestring—
size"md" | "sm" | "lg""md"
disabledboolean—
invalidboolean—
labelstring—
labelsPartial<{ decrease: string; increase: string; }>—names of the − and + buttons
modelValuenumber | nullnull

Events

NamePayloadDescription
update:modelValue[value: number | null]

Released under the MIT License. Character names and artwork belong to their owners.