NumberField

A numeric input field that uses the browser’s native type="number" input with optional minimum, maximum, and step constraints. The value is a nullable double, returning null when the field is empty.

Basic Usage

<ArcadiaForm Model="model">
    <NumberField Field="@nameof(Model.Quantity)" Label="Quantity" />
</ArcadiaForm>

With Constraints

<NumberField Field="@nameof(Model.Price)"
             Label="Price"
             Min="0"
             Max="10000"
             Step="0.01"
             Placeholder="0.00" />

Parameters

ParameterTypeDefaultDescription
Valuedouble?nullThe current numeric value. Null when the field is empty. Supports two-way binding.
ValueChangedEventCallback<double?>Callback invoked whenever the user changes the numeric value.
Mindouble?nullThe minimum allowed value. Leave null for no lower bound.
Maxdouble?nullThe maximum allowed value. Leave null for no upper bound.
Stepstring?nullThe increment granularity (e.g., "1", "0.01", "any"). Defaults to the browser default of 1.

Inherited from FieldBase

ParameterTypeDefaultDescription
Labelstring?nullVisible label displayed above the field.
Placeholderstring?nullPlaceholder text shown when the field is empty.
HelperTextstring?nullHelper text displayed below the field.
RequiredboolfalseWhether the field is required.
DisabledboolfalseWhether the field is disabled.
ReadOnlyboolfalseWhether the field is read-only.
ErrorsIReadOnlyList<string>?nullValidation errors to display.
SchemaFieldSchema?nullField schema definition for dynamic form generation.

Validation

public class OrderModel
{
    [Required]
    [Range(1, 999, ErrorMessage = "Quantity must be between 1 and 999.")]
    public double? Quantity { get; set; }
}

Accessibility

  • Label is linked to the input via for/id attributes.
  • The min, max, and step attributes are set on the native input for browser enforcement.
  • Required fields set aria-required="true" and display a visual * indicator.
  • Validation errors are linked via aria-describedby and announced with role="alert".