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
SinceNumericPicker
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 theNumericPicker
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 thestep
parameter.
<NumericPicker @bind-Value="" Step="10" />
@code{ decimal value; }
Setting the Min & Max
Set theMin
& Max
to limit the values allowed into the input.
<NumericPicker @bind-Value="" Min="10" Max="20" />
@code{ decimal value = 15; }
Integer values
If you define aTValue
as an integer type, NumericPicker
will automatically ignore Decimals
parameter and you will only be able to enter number without decimals.
<NumericPicker @bind-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 theModifyValueOnWheel
parameter.
<NumericPicker @bind-Value="" ModifyValueOnWheel WheelOn="NumericWheelOn.Hover" />
@code { decimal value; }