Class RadzenNumeric<TValue>
A numeric input component that allows users to enter numbers with optional increment/decrement buttons and value constraints. RadzenNumeric supports various numeric types, formatting, min/max validation, step increments, and culture-specific number display. Provides up/down arrow buttons for incrementing/decrementing the value by a specified step amount. Supports min/max constraints that are enforced during input and stepping, formatted value display using standard .NET format strings, and can be configured with or without the up/down buttons. Handles overflow protection and respects the numeric type's natural limits.
Inherited Members
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
Syntax
public class RadzenNumeric<TValue> : FormComponentWithAutoComplete<TValue>, IComponent, IHandleEvent, IHandleAfterRender, IDisposable, IRadzenFormComponent
Type Parameters
| Name | Description |
|---|---|
| TValue | The numeric type of the value. Supports int, long, short, byte, float, double, decimal and their nullable variants. |
Examples
Basic integer numeric input with constraints:
<RadzenNumeric @bind-Value=@quantity TValue="int" Min="1" Max="100" Step="1" />
Decimal input with custom formatting:
<RadzenNumeric @bind-Value=@price TValue="decimal" Min="0" Format="c" Placeholder="Enter price" />
Nullable numeric without increment buttons:
<RadzenNumeric @bind-Value=@optionalValue TValue="int?" ShowUpDown="false" Placeholder="Optional" />
Constructors
RadzenNumeric()
A numeric input component that allows users to enter numbers with optional increment/decrement buttons and value constraints. RadzenNumeric supports various numeric types, formatting, min/max validation, step increments, and culture-specific number display. Provides up/down arrow buttons for incrementing/decrementing the value by a specified step amount. Supports min/max constraints that are enforced during input and stepping, formatted value display using standard .NET format strings, and can be configured with or without the up/down buttons. Handles overflow protection and respects the numeric type's natural limits.
Declaration
public RadzenNumeric()
Examples
Basic integer numeric input with constraints:
<RadzenNumeric @bind-Value=@quantity TValue="int" Min="1" Max="100" Step="1" />
Decimal input with custom formatting:
<RadzenNumeric @bind-Value=@price TValue="decimal" Min="0" Format="c" Placeholder="Enter price" />
Nullable numeric without increment buttons:
<RadzenNumeric @bind-Value=@optionalValue TValue="int?" ShowUpDown="false" Placeholder="Optional" />
Fields
input
Gets input reference.
Declaration
protected ElementReference input
Field Value
| Type | Description |
|---|---|
| ElementReference |
Properties
ConvertValue
Gets or sets the function which returns TValue from string.
Declaration
[Parameter]
public Func<string, TValue> ConvertValue { get; set; }
Property Value
| Type | Description |
|---|---|
| Func<string, TValue> |
DownAriaLabel
Gets or sets the down button aria-label attribute.
Declaration
[Parameter]
public string DownAriaLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Format
Gets or sets the format.
Declaration
[Parameter]
public string Format { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The format. |
FormattedValue
Gets or sets the formatted value.
Declaration
protected string FormattedValue { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The formatted value. |
HasValue
Gets a value indicating whether this instance has value.
Declaration
public override bool HasValue { get; }
Property Value
| Type | Description |
|---|---|
| bool |
|
Overrides
Immediate
Gets or sets whether the component should update the bound value immediately as the user types (oninput event), rather than waiting for the input to lose focus (onchange event). This enables real-time value updates but may trigger more frequent change events.
Declaration
[Parameter]
public bool Immediate { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
InputAttributes
Gets or sets additional HTML attributes to be applied to the underlying input element. This allows passing custom attributes like data-* attributes, aria-* attributes, or other HTML attributes directly to the input.
Declaration
[Parameter]
public IReadOnlyDictionary<string, object> InputAttributes { get; set; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, object> | A dictionary of custom HTML attributes. |
Max
Determines the maximum value.
Declaration
[Parameter]
public decimal? Max { get; set; }
Property Value
| Type | Description |
|---|---|
| decimal? | The maximum value. |
MaxLength
Gets or sets the maximum allowed text length.
Declaration
[Parameter]
public long? MaxLength { get; set; }
Property Value
| Type | Description |
|---|---|
| long? | The maximum length. |
Min
Determines the minimum value.
Declaration
[Parameter]
public decimal? Min { get; set; }
Property Value
| Type | Description |
|---|---|
| decimal? | The minimum value. |
ReadOnly
Gets or sets a value indicating whether is read only.
Declaration
[Parameter]
public bool ReadOnly { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
ShowUpDown
Gets or sets a value indicating whether up down buttons are shown.
Declaration
[Parameter]
public bool ShowUpDown { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
Step
Gets or sets the step.
Declaration
[Parameter]
public string Step { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The step. |
TextAlign
Gets or sets the text align.
Declaration
[Parameter]
public TextAlign TextAlign { get; set; }
Property Value
| Type | Description |
|---|---|
| TextAlign | The text align. |
UpAriaLabel
Gets or sets the up button aria-label attribute.
Declaration
[Parameter]
public string UpAriaLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Value
Gets or sets the value.
Declaration
[Parameter]
public override TValue Value { get; set; }
Property Value
| Type | Description |
|---|---|
| TValue | The value. |
Overrides
Methods
BuildRenderTree(RenderTreeBuilder)
A numeric input component that allows users to enter numbers with optional increment/decrement buttons and value constraints. RadzenNumeric supports various numeric types, formatting, min/max validation, step increments, and culture-specific number display. Provides up/down arrow buttons for incrementing/decrementing the value by a specified step amount. Supports min/max constraints that are enforced during input and stepping, formatted value display using standard .NET format strings, and can be configured with or without the up/down buttons. Handles overflow protection and respects the numeric type's natural limits.
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | __builder |
Overrides
FocusAsync()
Sets the focus on the input element.
Declaration
public override ValueTask FocusAsync()
Returns
| Type | Description |
|---|---|
| ValueTask |
Overrides
GetComponentCssClass()
Gets the component CSS class.
Declaration
protected override string GetComponentCssClass()
Returns
| Type | Description |
|---|---|
| string |
Overrides
OnChange(ChangeEventArgs)
Handles the Change event.
Declaration
protected Task OnChange(ChangeEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| ChangeEventArgs | args | The ChangeEventArgs instance containing the event data. |
Returns
| Type | Description |
|---|---|
| Task |
SetParametersAsync(ParameterView)
Sets the parameters asynchronous.
Declaration
public override Task SetParametersAsync(ParameterView parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| ParameterView | parameters | The parameters. |
Returns
| Type | Description |
|---|---|
| Task | Task. |