{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "counter", "type": "registry:ui", "title": "Counter", "description": "A numeric input control featuring increment and decrement buttons, smoothly animating number transitions using the SlidingNumber component.", "dependencies": [ "motion" ], "registryDependencies": [ "button", "https://animate-ui.com/r/sliding-number" ], "files": [ { "path": "registry/components/counter/index.tsx", "content": "'use client';\n\nimport * as React from 'react';\nimport { motion, type HTMLMotionProps, type Transition } from 'motion/react';\n\nimport {\n SlidingNumber,\n type SlidingNumberProps,\n} from '@/components/animate-ui/text/sliding-number';\nimport { Button } from '@/components/ui/button';\nimport { cn } from '@/lib/utils';\n\ntype CounterProps = HTMLMotionProps<'div'> & {\n number: number;\n setNumber: (number: number) => void;\n slidingNumberProps?: Omit;\n buttonProps?: Omit, 'onClick'>;\n transition?: Transition;\n};\n\nfunction Counter({\n number,\n setNumber,\n className,\n slidingNumberProps,\n buttonProps,\n transition = { type: 'spring', bounce: 0, stiffness: 300, damping: 30 },\n ...props\n}: CounterProps) {\n return (\n \n \n setNumber(number - 1)}\n className={cn(\n 'bg-white dark:bg-neutral-950 hover:bg-white/70 dark:hover:bg-neutral-950/70 text-neutral-950 dark:text-white text-2xl font-light pb-[3px]',\n buttonProps?.className,\n )}\n >\n -\n \n \n\n \n\n \n setNumber(number + 1)}\n className={cn(\n 'bg-white dark:bg-neutral-950 hover:bg-white/70 dark:hover:bg-neutral-950/70 text-neutral-950 dark:text-white text-2xl font-light pb-[3px]',\n buttonProps?.className,\n )}\n >\n +\n \n \n \n );\n}\n\nexport { Counter, type CounterProps };\n", "type": "registry:ui", "target": "components/animate-ui/components/counter.tsx" } ] }