Blazorise NumericPicker component

A customizable NumericPicker component allows you to enter numeric values and contains controls for increasing and reducing the value.

Use <NumericPicker> to have a field for any kind of numeric values.

All basic types are supported, including nullable types: (int, long, float, double, decimal, etc.).

Examples

Basic

<NumericPicker Value="123" />

Rules

Generic type

Since NumericPicker is a generic component you will have to specify the exact data type for the value. Most of the time it will be recognized automatically when you set the Value attribute, but if not you will just use the TValue attribute and define the type manually eg.
<NumericPicker TValue="decimal?" />

Curency symbols

The display format of the NumericPicker can be adjusted to provide more context for the value it represents, such as displaying currency. By defining the CurrencySymbol parameter you can use any symbol. Additionally you can define the symbol position with the CurrencySymbolPlacement parameter.
<NumericPicker TValue="decimal?" CurrencySymbol="$" Value="456" />

Controlling the step value

Set the amount to increment or decrement the value when the spinner buttons are used with the step parameter.
<NumericPicker @bind-Value="@value" Step="10" />
@code{
    decimal value;
}

Setting the Min & Max

Set the Min & Max to limit the values allowed into the input.
<NumericPicker @bind-Value="@value" Min="10" Max="20" />
@code{
    decimal value = 15;
}

Integer values

If you define a TValue as an integer type, NumericPicker will automatically ignore Decimals parameter and you will only be able to enter number without decimals.
<NumericPicker @bind-Value="@value" />
@code{
    int value;
}

Modify Value With Mouse Wheel

Sometime you want to be able to change the value by scrolling with the mouse wheel when it is focused over the input. To enable it just use the ModifyValueOnWheel parameter.
<NumericPicker @bind-Value="@value" ModifyValueOnWheel WheelOn="NumericWheelOn.Hover" />
@code {
    decimal value;
}

API

Attributes

Name Description TypeDefault
TValue Generic type parameter used for the value attribute. generic
Value Gets or sets the value inside the input field. TValuedefault
ValueChanged Occurs after the value has changed. EventCallback<TValue>
Step Specifies the interval between valid values. decimal?null
Decimals Maximum number of decimal places after the decimal separator. int2
DecimalSeparator String to use as the decimal separator in numeric values. string"."
AlternativeDecimalSeparator String to use as the alternative decimal separator in numeric values. string","
GroupSeparator Defines the thousand grouping separator character. string
GroupSpacing Defines how many numbers should be grouped together (usually for the thousand separator). string3
CurrencySymbol Defines the currency symbol to display. string
CurrencySymbolPlacement Placement of the currency sign, relative to the number shown (as a prefix or a suffix). CurrencySymbolPlacementPrefix
Culture Helps define the localization of an element (used for parsing of the value). stringnull
Min The minimum value to accept for this input. TValuedefault
Max The maximum value to accept for this input. TValuedefault
MinMaxLimitsOverride Override the minimum and maximum limits. NumericMinMaxLimitsOverrideIgnore
Autofocus Set’s the focus to the component after the rendering is done. boolfalse
ShowStepButtons If true, step buttons will be visible. bool?true
EnableStep If true, enables change of numeric value by pressing on step buttons or by keyboard up/down keys. bool?true
SelectAllOnFocus If true, selects all the text entered in the input field once it receives the focus. boolfalse
RoundingMethod Method used for rounding decimal values. NumericRoundingMethodHalfUpSymmetric
AllowDecimalPadding Setting AllowDecimalPadding to 'false' will override the Decimals setting. NumericRoundingMethodAlways
AlwaysAllowDecimalSeparator Defines if the decimal character or decimal character alternative should be accepted when there is already a decimal character shown in the element. boolfalse
ModifyValueOnWheel Determine if the element value can be incremented / decremented with the mouse wheel. boolfalse
WheelOn Used in conjonction with the ModifyValueOnWheel option, defines when the wheel event will increment or decrement the element value, either when the element is focused, or hovered. NumericWheelOnFocus
On this page