InputNumber

InputNumber is an input component to provide numerical input.

InputNumber is used as a controlled input with ngModel property.

InputNumber is used as a controlled input with ngModel property.

numerals-demo

Localization information such as grouping and decimal symbols are defined with the locale property which defaults to the user locale.

locale-demo

Currency formatting is specified by setting the mode option to currency and currency property. In addition currencyDisplay option allows how the currency is displayed, valid values are "symbol" (default) or "code".

currency-demo

Custom texts e.g. units can be placed before or after the input section with the prefix and suffix properties.

prefix-suffix-demo

Spinner buttons are enabled using the showButtons options and layout is defined with the buttonLayout. Default value is "stacked" whereas "horizontal" and "stacked" are alternatives. Note that even there are no buttons, up and down arrow keys can be used to spin the values with keyboard.

buttons-demo

Buttons can also placed vertically by setting buttonLayout as vertical.

vertical-demo

A floating label appears on top of the input field when focused. Visit FloatLabel documentation for more information.

float-label-demo

IftaLabel is used to create infield top aligned labels. Visit IftaLabel documentation for more information.

ifta-label-demo

When showClear is enabled, a clear icon is displayed to clear the value.

clear-icon-demo

InputNumber provides small and large sizes as alternatives to the base.

sizes-demo

The fluid prop makes the component take up the full width of its container when set to true.

fluid-demo

Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.

filled-demo

When disabled is present, the element cannot be edited and focused.

disabled-demo

The invalid state is applied using the ⁠invalid property to indicate failed validation, which can be integrated with Angular Forms.

invalid-demo
template-driven-forms-demo

InputNumber can also be used with reactive forms. In this case, the formControlName property is used to bind the component to a form control.

reactive-forms-demo

Screen Reader

Value to describe the component can either be provided via label tag combined with inputId prop or using ariaLabelledBy, ariaLabel, ariaDescribedBy props. The input element uses spinbutton role in addition to the aria-valuemin, aria-valuemax and aria-valuenow attributes.

Keyboard Support

KeyFunction
tabMoves focus to the input.
up arrowIncrements the value.
down arrowDecrements the value.
homeSet the minimum value if provided.
endSet the maximum value if provided.
ON THIS PAGE
Templates
Highly customizable application templates to get started in no time with style. Designed and implemented by PrimeTek.
Learn More