logo

InputNumber

Enter a number within certain range with the mouse or keyboard.

When To Use

  • When a numeric value needs to be provided.

Types of Supports

sbyte, byte, short, ushort, int, uint, long, ulong, float, double, decimal

Nullable types of the above types are also supported. For example, ushort?, int?, etc.

Examples

Numeric-only input box.

expand code expand code

Click the button to toggle between available and disabled states.

expand code expand code

Display value within it's situation with formatter, and we usually use parser at the same time.

expand code expand code

No border.

expand code expand code

value's decimal places is determined by this Precision.

expand code expand code

There are three sizes available to a numeric input box. By default, the size is 32px. The two additional sizes are large and small which means 40px and 24px, respectively.

expand code expand code

A numeric-only input box whose values can be increased or decreased using a decimal step. The number of decimals (also known as precision) is determined by the step prop.

expand code expand code

Numeric-only input box.

expand code expand code

CultureInfo can be set to ensure proper parsing of strings depending on set locale. Especially useful in ServerSide deployments.

expand code expand code

InputNumber API#

Property Description Type Default Value
Precision ParameterNumber of decimal places to use for number and display Int32 0
Formatter ParameterFormatter from number to string for displaying Func<TValue, String> --
Format ParameterParser to extract number from the formatter String --
Parser ParameterSpecifies the value extracted from formatter Func<String, String> --
Step ParameterThe number to which the current value is increased or decreased with the input arrows. It can be an integer or decimal. TValue --
DefaultValue ParameterInitial value TValue --
Max ParameterMax alloable number TValue --
Min ParameterMin allowable number TValue --
MaxLength ParameterMax length of input Int32? false
Disabled ParameterDisable the input or not Boolean --
OnChange ParameterCallback executed when the input value changes EventCallback<TValue> --
OnFocus ParameterCallback executed when the input gains focus EventCallback<FocusEventArgs> --
PlaceHolder ParameterPlaceholder value String --
Bordered ParameterWhether to show border Boolean --
Prefix ParameterSetting prefix content to the input OneOf<String, RenderFragment> --
Width ParameterThe width of the input String --
ValidationMessages Validation messages for the FormItem String[] --
AdditionalAttributes ParameterGets or sets a collection of additional attributes that will be applied to the created element. IReadOnlyDictionary<String, Object> --
Value ParameterGets or sets the value of the input. This should be used with two-way binding. TValue --
ValueChanged ParameterCallback that updates the bound value. EventCallback<TValue> --
ValueExpression ParameterAn expression that identifies the bound value. Expression<Func<TValue>> --
ValuesExpression ParameterAn expression that identifies the enumerable of bound values. Expression<Func<IEnumerable<TValue>>> --
Size ParameterThe size of the input box. Note: in the context of a form, the `large` size is used. Available: `large` `default` `small` String AntSizeLDSType.Default
CultureInfo ParameterWhat Culture will be used when converting string to value and value to string Useful for InputNumber component. CultureInfo CultureInfo.CurrentCulture
Id ParameterID for the component's HTML String Uniquely Generated ID
Class ParameterSpecifies one or more class names for an DOM element. String --
Style ParameterSpecifies an inline style for a DOM element. String --
RefBack ParameterA ForwardRef instance. You can get a reference to the internal DOM by using AntDesign.ForwardRef.Current. ForwardRef --
Input Mentions
文档已更新,请点击 此处 更新。
A new version of this app is available. Click here to update.