Skip to content

API reference

The full NumberField surface: props, the two-way modelValue model, the change event, and the imperative handle. For the per-framework consumption code see the usage page.

Props

The full prop surface. The single model: true slice (modelValue, the Two-way column) is an optional two-way r-model with an uncontrolled fallback; as the sole model prop it drives the Angular ControlValueAccessor, so a number field is a form control.

NameTypeDefaultTwo-way (model)RequiredDescription
modelValueNumbernullThe numeric value of the field (two-way r-model). null means the field is empty. As the sole model: true prop it drives the Angular ControlValueAccessor, so a number field is a form control ([(ngModel)] / [formControl] bind directly). The value is clamped to [min, max] and snapped to step on every commit.
minNumbernullInclusive lower bound. Every commit clamps the value to >= min, and the Home key jumps to min. null (the default) means no lower bound. Also emitted as aria-valuemin.
maxNumbernullInclusive upper bound. Every commit clamps the value to <= max, and the End key jumps to max. null (the default) means no upper bound. Also emitted as aria-valuemax.
stepNumber1The increment/decrement granularity. ArrowUp / ArrowDown and the +/- buttons change the value by step, and every commit snaps the value to the nearest multiple of step measured from min (or 0 when min is null).
largeStepNumber10The coarse step applied by PageUp / PageDown, for fast traversal of a wide range.
formatOptionsObject{}Options forwarded to Intl.NumberFormat for locale-aware display formatting (e.g. { style: "currency", currency: "USD" } or { minimumFractionDigits: 2 }). The displayed text is formatted while the field is unfocused; on commit the formatting is stripped back off and the raw number is parsed.
allowScrubBooleanfalseOpt in to scrub-on-drag: press and drag horizontally on the field to change the value by step per few pixels (a power-user affordance). Off by default.
disabledBooleanfalseDisable the whole control — the input, both steppers, the keyboard, and scrubbing. Also sets the Angular ControlValueAccessor disabled state.
readonlyBooleanfalseMake the field read-only — the value is shown and focusable but cannot be changed by typing, the steppers, the keyboard, or scrubbing.
ariaLabelStringnullAccessible name applied to the role="spinbutton" input (aria-label). Provide this (or an external <label>) so the control is announced.

Models (the two-way value)

modelValue is the one model: true prop — number | null, where null is the empty field. Two-way bind it (r-model:modelValue / v-model:modelValue / bind:modelValue / [(modelValue)]) and the component writes the new clamped + snapped value back on every commit. Left unbound it falls back to an uncontrolled default.

Model (r-model:)ShapeChange eventDescription
modelValuenumber | nullchangeThe numeric value (null = empty). Written back clamped to [min, max] and snapped to step on every commit. As the sole model prop it drives the Angular ControlValueAccessor.

Events

EventDescription
changeFired on every committed change — a typed value committed on blur/Enter, a step (buttons / Arrow / Page / Home / End), a scrub, or a programmatic increment/decrement/clear. Payload { value } — the new clamped + snapped number, or null when empty.

Imperative handle

Declared once via $expose; obtained through each framework's native ref mechanism.

MethodDescription
focusMove DOM focus to the input and select its text. Deliberately overrides the inherited HTMLElement.focus on the Lit custom element (accepted, warn-only ROZ137).
incrementStep the value up by one step (clamped + snapped). Emits change.
decrementStep the value down by one step (clamped + snapped). Emits change.
clearSet the value to null (empty) and clear the edit buffer. Emits change.

Slots

NumberField declares no slots — the +/- steppers and the input are built in. Re-skin via the --rozie-number-field-* tokens (see the showcase).

Pre-v1.0 — internal monorepo.