{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "animated-number-demo", "registryDependencies": [ "animated-number" ], "files": [ { "path": "registry/default/example/animated-number-demo.tsx", "content": "\"use client\"\n\nimport { useState } from \"react\"\nimport { Minus, Plus } from \"lucide-react\"\nimport { toast } from \"sonner\"\n\nimport { Button } from \"@/components/ui/button\"\nimport { Slider } from \"@/components/ui/slider\"\nimport { AnimatedNumber } from \"@/registry/default/ui/animated-number\"\nimport { GradientHeading } from \"@/registry/default/ui/gradient-heading\"\nimport {\n TextureCardContent,\n TextureCardHeader,\n TextureCardStyled,\n} from \"@/registry/default/ui/texture-card\"\n\nfunction PrecisionExample() {\n const [value, setValue] = useState(14.5678)\n\n return (\n \n \n Precision\n \n \n
\n \n \n
\n setValue(value + 13.456)}\n >\n \n \n \n
\n
\n )\n}\n\nfunction FormatExample() {\n const [value, setValue] = useState(10)\n\n const customFormat = (num: number) => `$${num.toFixed(2)}`\n\n return (\n \n \n Format\n \n \n
\n \n \n
\n setValue(value + 50)}\n >\n \n \n \n
\n
\n )\n}\n\nfunction HooksExample() {\n const [value, setValue] = useState(10)\n\n const handleAnimationStart = () => {\n toast(\"🏁 Animation started \")\n }\n\n const handleAnimationComplete = () => {\n toast(\"✅ Animation completed \")\n }\n\n return (\n \n \n Callbacks\n \n \n
\n \n \n
\n setValue(value + 20)}\n >\n \n \n \n
\n
\n )\n}\n\nfunction CustomSpringExample() {\n const [value, setValue] = useState(1000)\n const [mass, setMass] = useState(1)\n const [stiffness, setStiffness] = useState(100)\n const [damping, setDamping] = useState(40)\n\n const handleValueChange =\n (setter: (value: number) => void, minValue: number) =>\n (values: number[]) => {\n const newValue = Math.max(values[0], minValue)\n setter(newValue)\n }\n\n return (\n \n \n Custom Spring Properties\n \n \n \n \n \n\n
\n setValue(value + 500)}\n >\n \n Increase\n \n setValue(value - 300)}\n >\n \n Decrease\n \n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n
\n
\n )\n}\n\nexport default function AnimatedNumberExamples() {\n return (\n
\n
\n \n
\n \n \n \n
\n
\n
\n )\n}\n", "type": "registry:component" } ], "type": "registry:component" }