Plan change preview
paddle/plan-change-previewFreeComponent
Compact plan change summary card with side-by-side plan comparison, proration breakdown, upgrade/downgrade badge, discount, scheduled change warning, and optional confirm/cancel actions. Decision-support view for plan change flows.
Install it
npx shadcn@latest add https://developer.paddle.com/r/plan-change-preview.jsonSource
1"use client"23import * as React from "react"4import { ArrowRight, AlertCircle } from "lucide-react"5import {6 Card,7 CardContent,8 CardDescription,9 CardHeader,10 CardTitle,11} from "@/registry/new-york/ui/card"12import { Badge } from "@/registry/new-york/ui/badge"13import { Skeleton } from "@/registry/new-york/ui/skeleton"14import { Separator } from "@/registry/new-york/ui/separator"15import { Alert, AlertDescription } from "@/registry/new-york/ui/alert"16import { cn } from "@/lib/utils"17import type { PlanChangePreviewData } from "@/registry/new-york/blocks/paddle-helpers/lib/paddle-types"18import {19 formatMoney,20 formatDate,21 formatBillingCycle,22 formatProrationMode,23} from "@/registry/new-york/blocks/paddle-helpers/lib/paddle-format"2425/** Props for the `PlanChangePreview` component. */26export type PlanChangePreviewProps = {27 preview?: PlanChangePreviewData28 /**29 * Paddle proration billing mode passed to `PATCH /subscriptions/{id}/preview`.30 * The component derives the billing row label and effective date from this value.31 */32 prorationBillingMode?:33 | "prorated_immediately"34 | "full_immediately"35 | "prorated_next_billing_period"36 | "full_next_billing_period"37 | "do_not_bill"38 className?: string39}4041export function PlanChangePreview({42 preview,43 prorationBillingMode,44 className,45}: PlanChangePreviewProps) {46 if (!preview) {47 return <PlanChangePreviewSkeleton className={className} />48 }4950 const {51 currency,52 currentPlan,53 newPlan,54 costImpact,55 discount,56 scheduledChange,57 subscriptionStatus,58 collectionMode,59 } = preview60 const isCharge = costImpact.resultDirection === "charge"61 const isCredit = costImpact.resultDirection === "credit"62 const isNeutral = costImpact.resultDirection === "none"63 const isManual = collectionMode === "manual"64 const isTrialing = subscriptionStatus === "trialing"6566 const changeType = isCharge ? "upgrade" : isCredit ? "downgrade" : "change"6768 const prorationLabel = prorationBillingMode69 ? formatProrationMode(prorationBillingMode)70 : undefined7172 const isImmediate =73 prorationBillingMode?.includes("immediately") || prorationBillingMode === "do_not_bill"7475 function resolveEffectiveDate(): string | undefined {76 if (prorationBillingMode) {77 if (isImmediate) return "Immediately"78 return costImpact.nextBillDate ? formatDate(costImpact.nextBillDate) : undefined79 }80 if (costImpact.immediateAmount !== undefined) return "Immediately"81// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from paddle
All 14 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Billing interval togglebilling-interval-toggle | paddle | Components | Free | no deps | |
| Checkout summarycheckout-summary | paddle | Components | Free | no deps · 3 files | |
| Plan change breakdownplan-change-breakdown | paddle | Components | Free | 1 dep · 3 files | |
| Pricing cardspricing-cards | paddle | Components | Free | 1 dep · 2 files | |
| Pricing select cardspricing-select-cards | paddle | Components | Free | 1 dep · 4 files | |
| Subscription alertsubscription-alert | paddle | Components | Free | 1 dep · 3 files | |
| Subscription payment cardsubscription-payment-card | paddle | Components | Free | 1 dep · 3 files | |
| Subscription status cardsubscription-status-card | paddle | Components | Free | 1 dep · 3 files |
