@zag-js/number-flow@2.0.0-next.2
Pre-release
Pre-release
·
0 commits
to main
since this release
Minor Changes
-
#3252
b819c61Thanks
@github-actions! - Add@zag-js/number-flow, a state machine for animating
a value change by rolling each digit to its new value. Use it for prices, scores, and live metrics, where a number
changing is worth noticing.Formatting goes through
Intl.NumberFormat, so currency, percent, and non-Latin numeral systems work out of the box.
Digits are keyed by decimal place, so999to1000adds one digit instead of re-keying the rest mid-roll.Unlike most machines, a digit is not one element. You render
api.digitCellsas a strip of0-9inside each digit,
and the machine translates the strip so the right cell lands in view.Parts:
root,valueText,digit,digitTrack,digitCell,symbol.