Skip to content

NumberField

A numeric input with native min/max attributes and step increments. These attributes guide input; command range rules enforce validity because the form uses noValidate.

PropTypeDefaultDescription
value(instance: TCommand) => unknownRequired. Accessor function returning the property value from the command instance.
titlestringThe label for the field.
placeholderstringPlaceholder text shown when empty.
minnumberNative input’s minimum attribute; not a command rule.
maxnumberNative input’s maximum attribute; not a command rule.
stepnumberIncrement/decrement step size.
requiredbooleanOverride automatic required detection.

The field displays 0 for an undefined value; editing the native control to empty or unparsable text also writes 0. It cannot preserve a distinct empty numeric value. Use a custom adapter if your command needs nullable/empty semantics. See Common props for styling and population.

These illustrative field fragments require imports for NumberField from @cratis/arc.react/commands and the named generated command classes. Place each fragment in its matching form; age and price are numeric properties. They are alternatives, not one complete component.

<NumberField<UserCommand>
value={c => c.age}
title="Age"
min={0}
max={120}
step={1}
/>
<NumberField<ProductCommand>
value={c => c.price}
title="Price"
min={0}
step={0.01}
placeholder="0.00"
/>