Skip to content

Number Input

Form InputsSince 0.2.0

Locale-aware numeric entry. NumberInput renders a text <input> with the spinbutton role (not native type=number, which ignores the locale’s separators and differs across browsers). It parses and formats group and decimal separators, locale digits (for example Arabic-Indic), minus-sign variants, and currency, percent, and unit literals through Intl.NumberFormat. It steps with the keyboard and optional stepper buttons, validates range and step with localized messages, and submits a canonical value through a hidden input.

  • Locale awareParses and formats group and decimal separators, locale digits, and minus signs for each locale.
  • Currency, percent, unitsDisplay formats from Intl.NumberFormat, while the submitted value stays canonical.
  • SteppingArrow keys and optional stepper buttons move the value by the configured step.
  • Range validationMinimum, maximum, and step checks with localized messages.
  • Accessible spinbuttonExposes the spinbutton role instead of the inconsistent native number input.

Use it for

  • Quantities, amounts, prices, percentages, and measurements users type or adjust in small increments.
  • Numbers that must be entered and displayed in the user’s locale (1.234,5 in German, Arabic-Indic digits in Arabic).
  • Values constrained by a minimum, maximum, or step.

Use something else for

  • Identifiers made of digits (card numbers, postal codes, phone numbers, one-time codes): use Text Input with inputMode ‘numeric’.
  • Picking a value on a continuous range where precision does not matter: use Slider.
  • Dates and times: use Date Input or Date Picker.
Anatomy
<div class="aui-field aui-number-input" data-aui-control> (consumer host)
<label class="aui-field__label" for=input>Label<span class="aui-field__required" aria-hidden="true">*</span></label>
<div class="aui-number-input__control">
<input class="aui-number-input__input" type="text" role="spinbutton" inputmode="decimal"
aria-valuenow aria-valuetext aria-valuemin aria-valuemax>
<button class="aui-number-input__stepper aui-number-input__decrement" tabindex="-1"> (showSteppers)
<button class="aui-number-input__stepper aui-number-input__increment" tabindex="-1"> (showSteppers)
</div>
<input type="hidden" name value="1234.5"> (canonical value)
<div class="aui-field__description"> (optional)
<div class="aui-field__error aui-validation-message"> (when shown)
</div>

Use the bar above each frame to switch theme, density, direction, and locale.

Number Input in the Employee profile form showcase

Section titled “Number Input in the Employee profile form showcase”

The part of the Employee profile form showcase that uses Number Input. Change its options, use it with the keyboard, and watch the event log; the link in the frame opens the full showcase. The bar above the frame switches theme, density, direction, and locale.

Showcase source
// Forms showcase: an employee profile form that uses every form control together,
// with constraint validation, a cross-field rule, the error summary, reset, and live options.
import { Button } from '@absoluteui/components/button';
import { Checkbox } from '@absoluteui/components/checkbox';
import { CheckboxGroup } from '@absoluteui/components/checkbox-group';
import { Combobox } from '@absoluteui/components/combobox';
import { Fieldset } from '@absoluteui/components/fieldset';
import { Form, type FormSubmitDetail } from '@absoluteui/components/form';
import { FormField } from '@absoluteui/components/form-field';
import { MultiSelect } from '@absoluteui/components/multi-select';
import { NumberInput } from '@absoluteui/components/number-input';
import { RadioGroup } from '@absoluteui/components/radio-group';
import { Select } from '@absoluteui/components/select';
import { Slider } from '@absoluteui/components/slider';
import { Switch } from '@absoluteui/components/switch';
import { TextInput } from '@absoluteui/components/text-input';
import { Textarea } from '@absoluteui/components/textarea';
import { ValidationMessage } from '@absoluteui/components/validation-message';
import { action, annotate, choice, createShowcase, hostIn, toggle } from './kit.js';
const sc = createShowcase({
title: 'Employee profile',
description: 'Every form control in one form: required fields, formats, ranges, a cross-field rule, and an error summary on submit.',
});
const form = document.createElement('form');
form.className = 'sc-form';
form.noValidate = true;
sc.stage.append(form);
// Each fieldset declares its controls, so a component's focus view shows its own group.
const fieldset = (legend: string, description?: string): HTMLFieldSetElement => {
const fs = document.createElement('fieldset');
form.append(fs);
Fieldset.enhance(fs, { legend, ...(description ? { description } : {}) });
return fs;
};
const DEPARTMENTS = [
{ value: 'eng', label: 'Engineering' },
{ value: 'fin', label: 'Finance' },
{ value: 'hr', label: 'People' },
{ value: 'ops', label: 'Operations' },
{ value: 'sales', label: 'Sales' },
];
const MANAGERS = ['Ada Kowalski', 'Bruno Silva', 'Chen Wei', 'Divya Nair', 'Emeka Obi', 'Farah Haddad', 'Grace Liu', 'Hiro Tanaka'].map((name) => ({ value: name.toLowerCase().replace(/\s+/g, '-'), label: name }));
const SKILLS = ['Accessibility', 'Angular', 'Data analysis', 'Design systems', 'Finance', 'Negotiation', 'People management', 'TypeScript'].map((s) => ({ value: s.toLowerCase().replace(/\s+/g, '-'), label: s }));
// Personal details.
const personal = annotate(fieldset('Personal details'), ['form', 'error-summary', 'fieldset', 'text-input', 'textarea', 'form-field']);
const name = TextInput.create(hostIn(personal), { label: 'Full name', name: 'name', required: true, minLength: 2, autocomplete: 'name' });
const email = TextInput.create(hostIn(personal), { label: 'Work email', name: 'email', type: 'email', required: true, autocomplete: 'email', description: 'Used for sign-in and notifications.' });
const phone = TextInput.create(hostIn(personal), { label: 'Phone', name: 'phone', type: 'tel', inputMode: 'tel', pattern: '[+]?[0-9 ]{7,20}', description: 'Digits and spaces, with an optional leading +.' });
const bio = Textarea.create(hostIn(personal), { label: 'About', name: 'bio', maxLength: 280, showCounter: true, rows: 3, resize: 'vertical' });
// A native control labelled and validated by Form Field.
const badge = document.createElement('input');
badge.name = 'badge';
badge.inputMode = 'numeric';
badge.pattern = '[0-9]{6}';
FormField.create(hostIn(personal), { label: 'Badge number', control: badge, description: 'Six digits printed on your badge.' });
// Role.
const role = annotate(fieldset('Role'), ['form', 'error-summary', 'validation-message', 'fieldset', 'select', 'combobox', 'radio-group', 'number-input', 'slider', 'multi-select']);
const department = Select.create(hostIn(role), { label: 'Department', name: 'department', options: DEPARTMENTS, placeholder: 'Choose a department', required: true });
const manager = Combobox.create(hostIn(role), { label: 'Manager', name: 'manager', options: MANAGERS, placeholder: 'Type a name', description: 'Search by first or last name.' });
const type = RadioGroup.create(hostIn(role), { label: 'Employment type', name: 'type', orientation: 'horizontal', required: true, options: [{ value: 'full', label: 'Full time' }, { value: 'part', label: 'Part time' }, { value: 'contract', label: 'Contractor' }] });
const salary = NumberInput.create(hostIn(role), { label: 'Annual salary', name: 'salary', min: 10000, max: 500000, step: 1000, format: { style: 'currency', currency: 'EUR', maximumFractionDigits: 0 } });
const hours = Slider.create(hostIn(role), { label: 'Weekly hours', name: 'hours', min: 8, max: 48, step: 1, largeStep: 4, value: 40, marks: [{ value: 20, label: '20' }, { value: 40, label: '40' }], showValue: true });
const skills = MultiSelect.create(hostIn(role), { label: 'Skills', name: 'skills', options: SKILLS, maxSelected: 5, description: 'Up to five.' });
// Preferences.
const prefs = annotate(fieldset('Preferences', 'You can change these later in settings.'), ['form', 'error-summary', 'fieldset', 'checkbox-group', 'switch', 'checkbox']);
const benefits = CheckboxGroup.create(hostIn(prefs), { label: 'Benefits', name: 'benefits', orientation: 'horizontal', options: [{ value: 'health', label: 'Health' }, { value: 'pension', label: 'Pension' }, { value: 'transit', label: 'Transit pass' }, { value: 'gym', label: 'Gym' }] });
const remote = Switch.create(hostIn(prefs), { label: 'Works remotely', name: 'remote' });
const terms = Checkbox.create(hostIn(prefs), { label: 'I confirm these details are correct', name: 'terms', required: true });
// A standalone validation message for a rule that is not tied to one control.
const actions = annotate(hostIn(form), ['form', 'error-summary', 'validation-message']);
actions.className = 'sc-form__actions';
const hint = ValidationMessage.create(hostIn(actions), { tone: 'info', message: 'Part-time employees work at most 32 hours per week.' });
const buttons = hostIn(actions);
buttons.className = 'sc-form__buttons';
const submit = Button.create({ text: 'Save profile', variant: 'primary', type: 'submit' }, document);
const reset = Button.create({ text: 'Reset', variant: 'secondary', type: 'reset' }, document);
buttons.append(submit.element, reset.element);
const formController = Form.create(form, {
summaryTitle: 'Fix these fields to save the profile',
rules: [
{
fields: ['type', 'hours'],
validate: (values) => (values.type === 'part' && Number(values.hours) > 32 ? 'Part-time employees work at most 32 hours per week.' : null),
},
],
});
form.addEventListener('aui-submit', (e) => {
const { values } = (e as CustomEvent<FormSubmitDetail>).detail;
submit.setLoading(true);
// A save takes a moment; the button stays busy and focusable meanwhile.
setTimeout(() => {
submit.setLoading(false);
hint.update({ tone: 'success', message: `Saved the profile of ${typeof values.name === 'string' ? values.name : 'the employee'}.` });
}, 600);
});
form.addEventListener('aui-reset', () => {
hint.update({ tone: 'info', message: 'Part-time employees work at most 32 hours per week.' });
});
sc.listen(form, ['aui-submit', 'aui-invalid', 'aui-reset'], 'form');
for (const [label, host] of [
['name', name.host],
['email', email.host],
['department', department.host],
['manager', manager.host],
['type', type.host],
['salary', salary.host],
['hours', hours.host],
['skills', skills.host],
['benefits', benefits.host],
['remote', remote.host],
['terms', terms.host],
] as const) {
sc.listen(host, ['aui-change'], label);
}
// Options.
const all = [name, email, phone, bio, department, manager, type, salary, hours, skills, benefits, remote, terms];
toggle(sc, 'Disabled', false, (disabled) => {
for (const c of all) c.update({ disabled });
badge.disabled = disabled;
submit.update({ disabled });
});
toggle(sc, 'Read-only', false, (readOnly) => {
for (const c of [name, email, phone, bio, department, manager, salary, skills]) c.update({ readOnly });
badge.readOnly = readOnly;
});
choice(
sc,
'Validate',
[
{ value: 'blur', label: 'When leaving a field' },
{ value: 'input', label: 'While typing' },
{ value: 'submit', label: 'On submit only' },
],
'blur',
(timing) => {
for (const c of [name, email, phone, bio, department, type, salary, benefits, terms]) c.update({ validationTiming: timing });
},
);
action(sc, 'Fill sample data', () => {
name.setValue('Ada Lovelace');
email.setValue('ada@example.com');
phone.setValue('+44 20 7946 0000');
bio.setValue('Writes the first programs and reviews every pull request.');
badge.value = '204816';
department.setValue('eng');
manager.setValue('chen-wei');
type.setValue('full');
salary.setValue(86000);
hours.setValue(38);
skills.setValue(['typescript', 'accessibility']);
benefits.setValue(['health', 'pension']);
remote.setChecked(true);
terms.setChecked(true);
sc.log('sample data filled');
});
action(sc, 'Submit empty', () => {
formController.reset();
formController.submit();
}, ['form', 'error-summary']);
import { NumberInput } from '@absoluteui/components/number-input';
const host = document.createElement('div');
document.body.append(host);
const quantity = NumberInput.create(host, { label: 'Quantity', name: 'quantity', value: 1, min: 1, max: 99, required: true });
host.addEventListener('aui-change', () => {
host.dataset.quantity = String(quantity.value ?? '');
});
import { NumberInput } from '@absoluteui/components/number-input';
const host = document.createElement('div');
document.body.append(host);
NumberInput.create(host, {
label: 'Preis',
name: 'price',
locale: 'de-DE',
min: 0,
step: 0.01,
format: { style: 'currency', currency: 'EUR', maximumFractionDigits: 2 },
});
import { NumberInput } from '@absoluteui/components/number-input';
const host = document.createElement('div');
document.body.append(host);
NumberInput.create(host, {
label: 'Discount',
min: 0,
max: 1,
step: 0.001,
format: { style: 'percent', maximumFractionDigits: 1 },
validate: (value) => (value !== null && value > 0.5 ? 'Discounts above 50% need approval.' : null),
});
import { configureAbsoluteUI } from '@absoluteui/core';
configureAbsoluteUI({ components: { numberInput: { showSteppers: false, validationTiming: 'blur' } } });
Terminal window
npm install @absoluteui/components @absoluteui/core @absoluteui/theme

Registry setup, the theme stylesheet, and the Content Security Policy are covered in Installation.

import { NumberInput } from '@absoluteui/components/number-input';
import '@absoluteui/components/number-input/style.css';
import { NumberInput } from '@absoluteui/components/number-input';
import '@absoluteui/components/number-input/style.css';
const host = document.querySelector<HTMLElement>('#quantity');
if (host) {
const quantity = NumberInput.create(host, { label: 'Quantity', name: 'quantity', value: 1, min: 1, max: 99, required: true });
host.addEventListener('aui-change', () => {
if (!quantity.validity.valid) quantity.reportValidity();
});
}
More usage
import { NumberInput } from '@absoluteui/components/number-input';
const host = document.createElement('div');
document.body.append(host);
NumberInput.create(host, { label: 'Preis', name: 'price', locale: 'de-DE', min: 0, step: 0.01, format: { style: 'currency', currency: 'EUR', maximumFractionDigits: 2 } });

Using Angular? See Number Input for Angular.

NumberInput.create(host: HTMLElement, options: NumberInputOptions): NumberInput

Global configuration key: numberInput (see Configuration).

Option Type Default Description
label string Visible label and accessible name. Required.
hideLabel boolean false Visually hide the label; it remains the accessible name.
value number | null null Initial value; also the value restored by reset().
name string Form field name, set on the hidden input that carries the canonical value.
placeholder string Supplementary hint; never replaces the label.
description string Help text referenced by aria-describedby.
required boolean false Empty value is invalid; shows the required indicator.
disabled boolean false Disables the input and steppers; the value is not submitted.
readOnly boolean false Value is focusable and submitted but not editable or steppable.
min number Minimum value; also the step base and the Home target.
max number Maximum value; End goes to the largest on-grid value <= max.
step number | null 1 Increment and step-validation grid (base min ?? 0). Default 0.01 for percent style. null: any value, increments of 1.
format { minimumFractionDigits?: number; maximumFractionDigits?: number; useGrouping?: boolean; style?: 'decimal' | 'percent' | 'currency' | 'unit'; currency?: string; unit?: string } Display format (Intl.NumberFormat subset). maximumFractionDigits also rounds the value on commit.
validate (value: number | null) => string | null Consumer validation; return a message to mark the value invalid.
icons Partial<{ error: IconRef; increment: IconRef; decrement: IconRef }> Icon slot overrides.
validationTiming 'blur' | 'input' | 'submit' "blur" When validation messages first appear; afterwards they update live. Globally configurable.
showSteppers boolean true Render increase/decrease buttons (pointer affordance; keyboard users use the arrow keys). Globally configurable.
locale string "en-US" Parsing, formatting, and message locale. Globally configurable. Inherited from common configuration.
Property Type Description
host HTMLElement Consumer host; its children are owned by the component.
input HTMLInputElement The visible text input (role=spinbutton).
formInput HTMLInputElement Hidden input carrying the canonical value and name.
value number | null Current parsed value; null when empty or unparseable.
text string Text in the input (raw while typing, formatted after commit).
name string | null Form field name.
label string Label text.
disabled boolean Disabled state.
validity FieldValidity { valid, error, message }; computed on every change.
dirty boolean Value differs from the initial value, or the text is unparseable.
touched boolean Focus has left the control at least once.
options Readonly<NumberInputOptions> Current instance options.
Method Description
setValue(value: number | null): void Programmatic value; reformats the display (no events); clears an external custom error.
update(options: Partial<NumberInputOptions>): void Merge and apply options.
reportValidity(): boolean Show messages now and return validity.
setCustomError(message: string | null): void External error (server, cross-field rule); cleared when the user edits.
getFormValue(): number | null Value for form serialization.
focus(): void Focus the input.
reset(): void Restore the initial value and clear dirty/touched/submitted state.
destroy(): void Remove rendering, listeners, registration, and subscriptions.
Event Detail Bubbles Cancelable Description
aui-input { value: number | null; text: string; validity: FieldValidity } Yes No User typed, or stepped (keyboard or stepper buttons, since 0.9.0); value is the parse of the raw text.
aui-change { value: number | null; validity: FieldValidity } Yes No User committed a changed value (blur, Enter, arrow/page/Home/End keys, or a stepper button).

All rules live in the aui.components cascade layer, so application styles override them without specificity battles.

Class Purpose
aui-field aui-number-input Host.
aui-number-input--invalid | --disabled State modifiers on the host.
aui-field__label | __required | __description | __error Shared field chrome.
aui-number-input__control Control boundary (input and stepper buttons).
aui-number-input__input Visible text input.
aui-number-input__stepper | __increment | __decrement Stepper buttons.
Slot Default icon
error alert-circle
increment plus
decrement minus

Tokens this stylesheet reads (verified in CI). Override them in a theme or with the Theme Designer.

--aui-border-width | --aui-color-border | --aui-color-border-strong | --aui-color-disabled-bg | --aui-color-error-fg | --aui-color-focus-ring | --aui-color-hover | --aui-color-surface | --aui-color-surface-sunken | --aui-color-text | --aui-color-text-disabled | --aui-color-text-muted | --aui-control-height-md | --aui-control-padding-x | --aui-duration-fast | --aui-easing-standard | --aui-font-family-sans | --aui-font-size-md | --aui-font-size-sm | --aui-font-weight-medium | --aui-icon-size-sm | --aui-line-height-normal | --aui-line-height-tight | --aui-radius-md | --aui-space-1

TypeScript definitions
interface NumberInputFormat {
minimumFractionDigits?: number;
maximumFractionDigits?: number;
useGrouping?: boolean;
style?: 'decimal' | 'percent' | 'currency' | 'unit';
currency?: string;
unit?: string;
}
interface NumberInputInputDetail { value: number | null; text: string; validity: FieldValidity }
interface NumberInputValueDetail { value: number | null; validity: FieldValidity }
interface FieldValidity { readonly valid: boolean; readonly error: ValidationErrorCode | null; readonly message: string }

Pattern: WAI-ARIA APG Spinbutton pattern on a text <input> with a <label for> association.

Checked on every docs build: the showcase passes axe (WCAG 2.2 A and AA rules) in the default, dark, and high-contrast themes and right to left; the playground loads without errors and passes axe before and after every on/off option is switched, with no Content Security Policy violations.

Key Context Action
Tab / Shift+Tab Any Moves focus to and from the input; stepper buttons are skipped.
ArrowUp / ArrowDown Input focused Increase / decrease by one step (from empty: min, else 0), clamped to [min, max].
PageUp / PageDown Input focused Increase / decrease by ten steps.
Home / End Input focused, min / max set Set the minimum / maximum. Without the bound, native caret movement.
Enter Input focused Commit: reformat the value and fire aui-change; implicit form submission is not prevented.
All editing keys Input focused Native text editing.
Element Role
input spinbutton
stepper buttons button (native), not in the tab order
icons none (aria-hidden=true)
Attribute Element Value
aria-valuenow input Current value; removed when empty or unparseable
aria-valuetext input Value formatted in the locale (for example 15% or $1,234.50)
aria-valuemin / aria-valuemax input min / max when set
aria-describedby input Help text and visible error message ids
aria-invalid input “true” only while an error message is shown
aria-label stepper buttons Localized Increase / Decrease
aria-controls stepper buttons Input id

The control boundary shows the focus indicator (border in color-focus-ring plus a 1px ring). Pressing a stepper button keeps focus in the input.

Criterion Level Note
1.3.1 Info and Relationships A
1.3.5 Identify Input Purpose AA
1.4.3 Contrast (Minimum) AA
1.4.11 Non-text Contrast AA
2.1.1 Keyboard A
2.4.7 Focus Visible AA
2.5.3 Label in Name A
2.5.8 Target Size (Minimum) AA
3.3.1 Error Identification A
3.3.2 Labels or Instructions A
3.3.3 Error Suggestion AA
4.1.2 Name, Role, Value A
4.1.3 Status Messages AA

Automated test results: Accessibility and compliance.

  • The required asterisk is aria-hidden; required state is conveyed by the native required attribute.
  • Errors appear after the first blur by default so users are not interrupted while typing.
  • Validation messages format numbers in the locale and style (for example ‘Enter a value of 1.000 or more.’).
  • The stepper buttons are a pointer affordance with tabindex -1; every action is available from the keyboard on the input.
  • Stepper buttons are disabled at the bounds.
  • Spinbutton announcements (aria-valuetext on step) have not yet been manually verified with NVDA, JAWS, and VoiceOver.
  • Mobile screen readers expose adjustable spinbutton gestures inconsistently for text inputs.
Import cost Minified gzip brotli CSS brotli
@absoluteui/components/number-input 48.7 kB 16.6 kB 14.8 kB 0.9 kB

Measured at build time, including every AbsoluteUI module the component pulls in. No third-party runtime dependencies.

Budget (enforced in CI) Limit
NumberInput.create, per instance (1,000 instances) < 1 ms average in headless Chromium

Tested scale: Target: 1,000 inputs on one page (performance test pending the e2e harness entry).

Four listeners per instance (input, blur, keydown, focusout), two per stepper button, and one configuration subscription. Intl.NumberFormat instances are built once per locale and format and reused. Budget: under 1 ms average per NumberInput.create across 1,000 instances.

Measured run times: Performance.

States

default, focus-visible, empty, filled, disabled, read-only, required, invalid (message shown), bad input, at minimum (decrement disabled), at maximum (increment disabled).

State transitions
From Trigger To
any user types text kept as typed; value parsed; bad-input when unparseable; dirty
editing blur or Enter committed: value rounded to maximumFractionDigits when set; text reformatted unless unparseable; aui-change if the value changed
any arrow, page, Home/End key, or stepper value stepped, clamped, snapped; text reformatted; aui-change
any focus leaves the host touched; messages shown (blur timing), after the pointer is released if focus left by a click
any reportValidity() submitted; messages shown for every timing
any locale or format changes while not focused text reformatted in the new locale
any reset() initial value, formatted; pristine, untouched
Accessibility notes
  • The required asterisk is aria-hidden; the native required attribute conveys the state.
  • Errors appear after the first blur by default, then update live.
  • Messages format numbers in the locale and style: Enter a value of 1.000 or more. in German.
  • inputmode="decimal" (or numeric when maximumFractionDigits is 0) selects the virtual keyboard.
  • Stepper buttons are a pointer affordance; pressing one keeps focus in the input. Every action is available from the keyboard.
  • Manual screen-reader verification is pending (see Known limitations).
Responsive behavior

Full width of its container. The stepper buttons keep their size and the input shrinks. Density tokens change the control height and button width.

Right-to-left

Logical properties: the stepper buttons sit at the inline end in both directions. Bidi control marks that Intl inserts in RTL locales are ignored when parsing.

Theming

Colors come from role tokens only. In forced-colors mode, focus draws a Highlight outline and disabled steppers use GrayText.

Global configuration
configureAbsoluteUI({ components: { numberInput: { showSteppers: false, validationTiming: 'input' } } });

Changes apply to existing instances immediately. A locale change reformats the text of inputs that are not focused.

Component configuration

Instance options override global and theme defaults. All options are dynamic.

Icons

icons.error (default alert-circle), icons.increment (default plus), and icons.decrement (default minus).

Security

All text uses textContent or attributes. Validation messages never include the entered text; only constraint parameters. No style attributes or HTML sinks. CSP-safe.

Data handling

No persistence, network access, or telemetry. The visible input is not named; a hidden input named name carries the canonical value (1234.5, empty when null or unparseable, and not submitted while disabled).

Supported data scale

Values are JavaScript numbers: exact up to 15 significant digits and integers up to 2^53. 1,000 inputs per page is the performance target.

Edge cases
  • Percent style: typed 15 and 15% are both 0.15; the default step is 0.01.
  • de-DE: 1.234,5 is 1234.5; a lone . is a group separator, so 1.5 is 15.
  • ar-EG: ١٬٢٣٤٫٥ and ASCII 1234.5 are both accepted; the display uses Arabic-Indic digits.
  • -5 (U+2212), -5, and a leading + are accepted.
  • Currency: $1,234.50, 1234.5, and USD 1234.5 parse to the same value.
  • Unparseable text (12abc, two decimal separators) is bad-input: value is null, the text is kept for correction, and the hidden input is empty.
  • Stepping from an off-grid value snaps to the grid in the step direction (8 with step 5 from min 1 goes up to 11, down to 6); the result is rounded to the step’s decimal places (0.2 + 0.1 steps to 0.3).
  • maximumFractionDigits rounds the committed value with decimal (not binary) rounding: 1234.505 becomes 1234.51.
Errors
Code Category Cause
NUMBER_INPUT_OPTIONS configuration Missing label; non-finite value, min, or max; min > max; step <= 0; invalid format fields (style, missing currency/unit, fraction digits).
NUMBER_INPUT_FORMAT configuration Intl.NumberFormat rejected the format for the locale (for example an unknown unit).
Validation (validity.error) validation value-missing, bad-input, range-underflow, range-overflow, step-mismatch, custom.

A failed construction leaves no rendering, listeners, or subscriptions behind. A failed update() keeps the previous options.

Known limitations
  • IEEE 754 doubles: no arbitrary-precision decimals or BigInt.
  • Parsing is strict to the locale; group separator positions are not validated.
  • Accounting (parenthesized negatives), scientific, engineering, and compact notation are not parsed.
  • The hidden canonical value uses JavaScript number serialization (exponent notation below 1e-6 and from 1e21).
  • With inputmode="numeric" some mobile keyboards have no minus key.
  • Stepper buttons do not repeat on press-and-hold.
  • Screen-reader behavior has not yet been manually verified with NVDA, JAWS, and VoiceOver.
Unsupported scenarios
  • Native type=number behavior (wheel stepping, browser spin buttons).
  • HTML in the label, help text, or messages.
  • BigInt values.