diff --git a/rfcs/2025-number-field-stepping.md b/rfcs/2025-number-field-stepping.md new file mode 100644 index 00000000000..6832692b2bf --- /dev/null +++ b/rfcs/2025-number-field-stepping.md @@ -0,0 +1,67 @@ + + +- Start Date: 2025-04-09 +- RFC PR: +- Authors: @AndrewLeedham + +# Number Field Stepping + +## Summary + +The step option for number fields limits decimal places of the saved value, that is to say you cannot increment/decrement by a different precision that the value is stored. + +## Motivation + +Certain values (especially in science based domains) may want to be displayed with say 4 decimal places, but incrementing/decrementing by 0.0001 is too fine-grained, something like 0.1 or even 1 often makes more sense. + +## Detailed Design + +Introducing a new prop say `interval` which controls how the field is incremented/decremented across all mediums (buttons, arrow keys, mouse wheel etc.) would allow the value to be optionally specified separately from `step`. This prop should only influence incrementing and decrementing it should not round/clamp the value to the same number of decimal places as `step` does, but `step` should retain this behaviour. + +## Documentation + +Since the proposed `interval` prop does not change existing behaviour, a simple addition to the documentation should suffice. + +## Drawbacks + +- Explaining the difference between `step` and `interval` may be tricky. +- This strays from built-in behaviour of number inputs which only provide the `step` option. + +## Backwards Compatibility Analysis + +No change. + +## Alternatives + +The only feasible alternative would be to rewrite the `` logic from scratch, or use a different library. + +## Open Questions + +Does having 2 options similarly named `step` and `interval` make sense or should it be `step` or `clamp` and `interval`? + +## Help Needed + +If we are happy with the approach, I am happy to give an implementation a go. + +## Frequently Asked Questions + + + +## Related Discussions + +- https://github.com/adobe/react-spectrum/issues/7288 +- https://github.com/adobe/react-spectrum/issues/6359 +- https://github.com/adobe/react-spectrum/issues/7867