{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "pricing-1", "type": "registry:block", "description": "Responsive pricing section with frequency toggle, tooltips, and highlightable plans.", "dependencies": [ "motion" ], "registryDependencies": [ "button", "tooltip" ], "files": [ { "path": "registry/blocks/pricing/1/pricing-section.tsx", "content": "\"use client\";\nimport { CheckCircleIcon, StarIcon } from \"lucide-react\";\nimport Link from \"next/link\";\nimport React from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport { cn } from \"@/lib/utils\";\nimport { type FREQUENCY, FrequencyToggle } from \"./frequency-toggle\";\n\nexport type Plan = {\n name: string;\n info: string;\n price: {\n monthly: number;\n yearly: number;\n };\n features: {\n text: string;\n tooltip?: string;\n }[];\n btn: {\n text: string;\n href: string;\n };\n highlighted?: boolean;\n};\n\ninterface PricingSectionProps extends React.ComponentProps<\"div\"> {\n plans: Plan[];\n heading: string;\n description?: string;\n}\n\nexport function PricingSection({\n plans,\n heading,\n description,\n ...props\n}: PricingSectionProps) {\n const [frequency, setFrequency] = React.useState<\"monthly\" | \"yearly\">(\n \"monthly\"\n );\n\n return (\n \n
\n

\n {heading}\n

\n {description && (\n

\n {description}\n

\n )}\n
\n\n \n
\n {plans.map((plan) => (\n \n ))}\n
\n \n );\n}\n\ntype PricingCardProps = React.ComponentProps<\"div\"> & {\n plan: Plan;\n frequency?: FREQUENCY;\n};\n\nexport function PricingCard({\n plan,\n className,\n frequency = \"monthly\",\n ...props\n}: PricingCardProps) {\n return (\n \n \n
\n {plan.highlighted && (\n

\n \n Popular\n

\n )}\n {frequency === \"yearly\" && (\n

\n {Math.round(\n ((plan.price.monthly * 12 - plan.price.yearly) /\n plan.price.monthly /\n 12) *\n 100\n )}\n % off\n

\n )}\n
\n\n
{plan.name}
\n

{plan.info}

\n

\n \n ${plan.price[frequency]}\n \n \n {plan.name !== \"Free\"\n ? `/${frequency === \"monthly\" ? \"month\" : \"year\"}`\n : \"\"}\n \n

\n \n \n {plan.features.map((feature, index) => (\n
\n \n \n \n \n \n {feature.text}\n

\n
\n {feature.tooltip && (\n \n

{feature.tooltip}

\n
\n )}\n
\n
\n
\n ))}\n \n \n \n {plan.btn.text}\n \n \n \n );\n}\n", "type": "registry:component" }, { "path": "registry/blocks/pricing/1/frequency-toggle.tsx", "content": "\"use client\";\nimport { motion } from \"motion/react\";\nimport type React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport type FREQUENCY = \"monthly\" | \"yearly\";\n\ntype FrequencyToggleProps = React.ComponentProps<\"div\"> & {\n frequency: FREQUENCY;\n setFrequency: React.Dispatch>;\n frequencies?: FREQUENCY[];\n};\n\nexport function FrequencyToggle({\n frequency,\n setFrequency,\n frequencies = [\"monthly\", \"yearly\"],\n ...props\n}: FrequencyToggleProps) {\n return (\n \n {frequencies.map((freq) => (\n setFrequency(freq)}\n >\n {freq}\n {frequency === freq && (\n \n )}\n \n ))}\n \n );\n}\n", "type": "registry:component" } ], "categories": [ "pricing" ] }