Skip to content

Number Field ​

An input for numbers with decrement / increment buttons. Hold a button to repeat; arrow up / down step with a keyboard; typed values are clamped on Enter or blur.

Usage ​

Approximate web preview — the HarmonyOS rendering is the reference.

Step, decimals & states ​

Approximate web preview — the HarmonyOS rendering is the reference.

API ​

Extracted from the @Param / @Event / @BuilderParam declarations in the library sources.

SNumberField ​

shadcn-vue NumberField (NumberFieldContent + Decrement + Input + Increment in one component): an input with centred text and − / + buttons inside it.

  • Holding − / + repeats (touch / mouse); a click, Space / Enter or the screen reader steps once. The value is clamped to [min, max] and rounded to the step's precision.
  • Typing is free; the text is parsed and clamped on Enter or blur (invalid text reverts).
  • Keyboard: arrow up / down step while the input is focused.
  • decimals formats the shown value with a fixed number of decimals (formatOptions-lite).
PropTypeDefaultDescription
value!!number | undefinedundefinedControlled value (use with !!). Leave undefined for uncontrolled.
defaultValuenumber0
minnumber | undefinedundefined
maxnumber | undefinedundefined
stepnumber1
decimalsnumber | undefinedundefinedFixed number of decimals shown (undefined = as needed).
disabledbooleanfalse
invalidbooleanfalse
labelstring | undefinedundefinedAccessible name when there is no visible label.
EventTypeDefaultDescription
onValueChange(v: number) => void() => { }

MIT Licensed