humanonlyweb/ui

Spin Button

A number input with step buttons.

Markdown

Examples

Basic

Between 1 and 50.

Copy code

Decimal step

Values round to the step's precision.

Copy code

API

PropTypeDefault
id

Id for the control; generated with useId() when omitted.

string—
min

Lowest value. Home jumps here.

numberNumber.NEGATIVE_INFINITY
max

Highest value. End jumps here.

numberNumber.POSITIVE_INFINITY
step

Arrow-key and button increment; PageUp/PageDown move ten steps. Its decimals set the rounding.

number1
hint

Help text under the control, announced as its description.

string—
label

Visible label, linked to the control.

string—
optional

Appends the optional translation to the label.

booleanfalse
disabled

Disables the control.

booleanfalse
error

true marks the control invalid; a string also shows it as the message, replacing the hint.

string | boolean—
modelValue

The value. undefined while the input is empty.

number—
EventPayload
update:modelValue

v-model:modelValue update.

[value: number | undefined]
SlotProps
decrement

Decrease button icon.

—
increment

Increase button icon.

—

Styling

Parts
fieldfield-labelfield-optionalspinbuttonspinbutton-decrementspinbutton-inputspinbutton-incrementfield-message
States
data-field-errordata-spinbutton-errordata-spinbutton-disableddata-field-tone

Keyboard

KeysAction
↑ / ↓Step up / down
Page Up / Page DownTen steps
Home / EndMinimum / maximum

Accessibility

  • The buttons repeat while held and are skipped by Tab.
  • Values are clamped and rounded on blur.