{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "pricing-toggle", "title": "Pricing Toggle", "description": "Monthly/annual toggle with animated price swap using Framer Motion", "dependencies": [ "motion" ], "files": [ { "path": "registry/pioneerui/pricing-toggle.tsx", "content": "\"use client\"\n\nimport React, { useState } from \"react\"\nimport { motion, AnimatePresence } from \"motion/react\"\nimport { cn } from \"@/lib/utils\"\n\nexport interface PricingToggleProps {\n monthlyLabel?: string\n annualLabel?: string\n discount?: string\n onChange?: (isAnnual: boolean) => void\n defaultAnnual?: boolean\n className?: string\n}\n\nexport function PricingToggle({\n monthlyLabel = \"Monthly\",\n annualLabel = \"Annual\",\n discount = \"Save 20%\",\n onChange,\n defaultAnnual = false,\n className,\n}: PricingToggleProps) {\n const [isAnnual, setIsAnnual] = useState(defaultAnnual)\n\n const toggle = (annual: boolean) => {\n setIsAnnual(annual)\n onChange?.(annual)\n }\n\n return (\n
\n toggle(false)}\n className={cn(\n \"text-sm font-medium transition-colors duration-150\",\n !isAnnual ? \"text-foreground\" : \"text-muted-foreground hover:text-foreground\",\n )}\n >\n {monthlyLabel}\n \n\n toggle(!isAnnual)}\n className={cn(\n \"relative h-6 w-11 rounded-full border-2 border-transparent transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n isAnnual ? \"bg-primary\" : \"bg-input\",\n )}\n >\n \n \n\n toggle(true)}\n className={cn(\n \"flex items-center gap-1.5 text-sm font-medium transition-colors duration-150\",\n isAnnual ? \"text-foreground\" : \"text-muted-foreground hover:text-foreground\",\n )}\n >\n {annualLabel}\n {discount && (\n \n {isAnnual && (\n \n {discount}\n \n )}\n \n )}\n \n
\n )\n}\n\nexport interface AnimatedPriceProps {\n monthly: string | number\n annual: string | number\n isAnnual: boolean\n currency?: string\n period?: boolean\n}\n\nexport function AnimatedPrice({\n monthly,\n annual,\n isAnnual,\n currency = \"$\",\n period = true,\n}: AnimatedPriceProps) {\n const current = isAnnual ? annual : monthly\n\n return (\n
\n {currency}\n \n \n {current}\n \n \n {period && (\n \n /{isAnnual ? \"yr\" : \"mo\"}\n \n )}\n
\n )\n}\n", "type": "registry:ui", "target": "components/pioneerui/pricing-toggle.tsx" } ], "type": "registry:ui" }