I am using the <s-number-field>
component with the following configuration:
<s-number-field
label="Quantity"
details="Number of items in stock"
placeholder="10"
step="5"
min="0"
max="100"
value={quantity}
onInput={(e) =>
setQuantity(parseInt(e.target.value))
}
></s-number-field>
Expected Behavior:
- The input should only accept integers.
- If a user enters a decimal, it should either prevent input or automatically correct it to an integer (e.g.,
10.5 → 10
).
Actual Behavior:
- The component allows decimals to be entered.
- Reassigning the corrected integer value to the input does not update the displayed value.
Question:
- Is there a way to configure
<s-number-field>
to strictly accept only integer values? - If not, what’s the recommended approach to enforce integer-only input while ensuring the field updates correctly?