Skip to content

InputNumber

<ax-input-number> is a numeric field with side −/+ steppers, bounds, step, precision, and optional prefix/suffix. It implements ControlValueAccessor over number | null and exposes a two-way [(value)]. The field matches ax-input (shared inputVariants).

Typing updates the value without rewriting the field mid-edit (no caret jump); blur clamps to [min, max], rounds to precision, and reflects the formatted value. The −/+ buttons and ↑/↓ arrow keys step (with hold-to-repeat on press).

import { AxInputNumberComponent } from '@axisui-ng/forms';
<ax-input-number [(value)]="qty" [min]="0" [max]="99" ariaLabel="Quantity" />
<ax-input-number [(value)]="price" [precision]="2" [step]="0.5" prefix="$" ariaLabel="Price" />
<ax-input-number [(value)]="pct" [min]="0" [max]="100" [step]="5" suffix="%" ariaLabel="Discount" />
OptionValuesDefaultNotes
size'sm' | 'md' | 'lg''md'Shared with ax-input (inputVariants).
<ax-input-number [(value)]="qty" size="sm" [min]="0" ariaLabel="Quantity" />
InputTypeDefaultNotes
valuemodel<number | null>nullTwo-way + CVA.
minnumber | nullnullLower bound (clamped on step + blur).
maxnumber | nullnullUpper bound (clamped on step + blur).
stepnumber1Step increment.
precisionnumber | nullnullDecimal places (rounded on step + blur).
prefixstring''Adornment before the number (e.g. $).
suffixstring''Adornment after the number (e.g. %).
placeholderstring''Placeholder text.
size'sm' | 'md' | 'lg''md'Control height/padding.
disabledbooleanfalseAlso set by setDisabledState.
readonlybooleanfalseRead-only.
invalidbooleanfalseError styling + aria-invalid on the wrapper.
describedBystring | nullnullaria-describedby.
ariaLabelstring''Accessible name for the spinbutton.

The input is role="spinbutton" with aria-valuenow/min/max + inputmode="decimal"; ↑/↓ adjust it. The −/+ buttons are tabindex="-1" + aria-hidden (the spinbutton arrow keys are the accessible control), and are disabled at the respective bound.

Interactive examples live in Storybook under Forms / InputNumber. Run pnpm storybook to explore them.