{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"number-ticker","type":"registry:ui","title":"Odometer Number","description":"Number that rolls each digit on its own spring reel, staggered left to right, when it scrolls into view or the value changes.","author":"GetUrUI <hello@geturui.dev>","dependencies":["motion"],"registryDependencies":[],"files":[{"path":"registry/geturui/ui/number-ticker.tsx","type":"registry:ui","target":"components/ui/number-ticker.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\nimport { motion, useInView } from \"motion/react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface NumberTickerProps {\n  value: number;\n  prefix?: string;\n  suffix?: string;\n  decimals?: number;\n  /** Start from this value on first view. */\n  from?: number;\n  /** Delay between digits, seconds. */\n  stagger?: number;\n  className?: string;\n}\n\nconst DIGITS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];\n\nfunction Reel({ digit, delay }: { digit: number; delay: number }) {\n  return (\n    <span className=\"relative inline-block h-[1em] overflow-hidden leading-none\" aria-hidden>\n      <motion.span\n        className=\"flex flex-col\"\n        initial={false}\n        animate={{ y: `${-digit}em` }}\n        transition={{ type: \"spring\", stiffness: 160, damping: 20, delay }}\n      >\n        {DIGITS.map((d) => (\n          <span key={d} className=\"block h-[1em] leading-none\">\n            {d}\n          </span>\n        ))}\n      </motion.span>\n    </span>\n  );\n}\n\n/** Number that rolls each digit on its own spring reel, staggered left to right. Starts when scrolled into view. */\nexport function NumberTicker({ value, prefix = \"\", suffix = \"\", decimals = 0, from = 0, stagger = 0.04, className }: NumberTickerProps) {\n  const ref = React.useRef<HTMLSpanElement>(null);\n  const inView = useInView(ref, { once: true, margin: \"-40px\" });\n  const shown = inView ? value : from;\n  const fmt = (n: number) =>\n    prefix + n.toLocaleString(\"en-US\", { minimumFractionDigits: decimals, maximumFractionDigits: decimals }) + suffix;\n  const chars = fmt(shown).split(\"\");\n\n  return (\n    <span ref={ref} className={cn(\"inline-flex items-baseline tabular-nums leading-none\", className)} role=\"text\" aria-label={fmt(value)}>\n      {chars.map((c, i) => {\n        const key = chars.length - i;\n        return /\\d/.test(c) ? (\n          <Reel key={`d${key}`} digit={Number(c)} delay={i * stagger} />\n        ) : (\n          <span key={`s${key}`} aria-hidden>\n            {c}\n          </span>\n        );\n      })}\n    </span>\n  );\n}\n"},{"path":"LICENSE-geturui.md","type":"registry:file","target":"LICENSE-geturui.md","content":"MIT License\n\nCopyright (c) 2026 geturui.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"}],"categories":["components","number","counter","ticker","pricing","stats","odometer"],"meta":{"tier":"free","license":"MIT","docs":"https://geturui.com/docs/number-ticker"}}