NumberField: Separate step for increment/decrement buttons vs. input validation #6538
oleh-kolinko
started this conversation in
Feature requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Heroui v3.0.5
The step prop currently controls both the increment/decrement button delta AND the snapping of manually entered values. There's no way to configure these independently.
Our Use case
Currency/money inputs where:
I have NumberField with incrementing by $5 but also allow manual input down to cents, so we have
step={5},formatOptions={{ currency: "USD", style: "currency" }}And when trying to type anything that is not by step 5 e.g.
16.44snaps to 15 on blur. Which is not desired behavior and very limitingProposed API
Or alternatively, define
stepon separately on IncrementButton itselfor allow passing a custom onPress to the stepper buttons that replaces (not supplements) the built-in increment behavior:
The only workaround is replacing NumberField.IncrementButton / NumberField.DecrementButton with plain elements that bypass the slot system entirely losing accessibility attributes and HeroUI's press/focus handling
All reactions