Skip to content

Number Field

Preserve exact decimal input while validating or evaluating text drafts.

Usage

Exact decimal

Enter 0.1 as decimal text and preserve it without binary floating-point coercion.

Committed value0.1

Calculator

Enter 50-20% and commit the calculated result as 40.

Committed value50

Exponent

Enter 2^3^2 and evaluate exponentiation from right to left.

Committed value2

Bounded

Reject values outside the configured minimum and maximum.

Committed value40.25

API

Vue package: @sectile/vue/number-field

Components
  • NumberField

Props

NumberFieldProps

defaultValue

Initial value used when the component owns its state.

disabled

Whether interaction is unavailable.

label

Accessible name announced for the control.

modelValue

Current value when state is controlled by the parent.

native

Whether to use the browser native date or time input UI.

policies

Behavior policies that customize validation, movement, or selection.

readonly

Whether the value can be inspected but not changed.

required

Whether the control must contain a valid value before submission.

Parts

Shared scope: [data-scope="number-field"]. Combine it with a part selector to keep styles local to this component.

PartSelectorRoleExtra attributes
input[data-part="input"]Accepts the editable value or draft.

Keyboard interaction

KeyBehavior
Standard editing keysEdit and select text with the host input conventions.
TabCommit focus movement without replacing native text behavior.

Accessibility

The labeled input preserves native editing and exposes invalid, disabled, and readonly state.

Released under the MIT License.