Skip to content

Number Field ​

bo-number-field combines a native number input with increment and decrement buttons. Its model is number | undefined; empty input produces undefined. Alphabetic characters, including exponent notation, are rejected by default; set allow-exponent when scientific notation is required.

Basic Usage ​

Choose between 1 and 10.

Value: 2

<bo-number-field v-model="quantity" label="Quantity" :min="1" :max="10" hint="Choose between 1 and 10." />

Form States ​

min, max, and step constrain the stepper buttons. description, error, and hint share one helper-text region, with error taking precedence.

Changes in increments of two.
Enter a valid quantity.
<div class="grid gap-4"><bo-number-field label="Seats" :min="1" :step="2" description="Changes in increments of two." /><bo-number-field label="Read-only value" :model-value="8" read-only /><bo-number-field label="Invalid value" error="Enter a valid quantity." /></div>

API Reference ​

PropTypeDefaultDescription
modelValuenumber | undefinedundefinedValue used by v-model.
min / maxstring-Native numeric bounds.
stepstring-Stepper increment; non-positive values use 1.
allowExponentbooleanfalseAllows exponent notation such as 1e3.
placeholderstring-Input placeholder.
inputModeInputHTMLAttributes['inputmode']decimalKeyboard hint.
labelstring-Visible label.
description / error / hintstring-Helper text; error wins.
requiredbooleanfalseNative required state.
disabledbooleanfalseDisables input and buttons.
readOnlybooleanfalsePrevents editing and stepping.
namestring-Native form name.
autofocusbooleanfalseFocuses on mount.
roleHTMLAttributes['role']spinbuttonInput role.
ariaLabel / ariaLabelledBy / ariaDescribedBystring-Accessible naming and description.

The component emits update:modelValue, focus, blur, and change. It exposes focus().

Released under the MIT License.