Plan Picker

The exact charge printed under the button: prorated today, then the renewal.

PROGet Plan Picker and 168 other Pro components with pro lifetime — Get Pro

Category
Billing
Access
Pro
Source
423 lines · one file
Added
28 Sept 2026

The decision inside it

Your backend quotes, the picker never does the arithmetic

Proration rules differ by processor and by contract. The picker asks a quote function you supply and prints what comes back, so the number under the button is the number on the invoice.

When to use it

Use Plan Picker to change plans: plan cards with monthly and yearly prices (in cents), a quote function that says what changes today (charge, credit, blocked with a reason) and a confirm button that names the consequence.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Liro's Plan Picker for this.
Install it: npx shadcn@latest add @liro/plan-picker
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/plan-picker.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.

Usage

components/change-plan.tsx
import { PlanPicker, type PickerPlan, type BillingInterval, type PlanQuote } from "@/components/ui/plan-picker";

const plans: PickerPlan[] = [
  { id: "starter", name: "Starter", monthly: 1900, yearly: 19000, features: ["3 seats", "Email support"] },
  { id: "team", name: "Team", monthly: 8900, yearly: 89000, features: ["10 seats", "Priority support"], badge: "Popular" },
];

function quote(planId: string, interval: BillingInterval): PlanQuote {
  if (planId === "team" && interval === "month") return { kind: "current" };
  return { kind: "charge", today: 4200, next: 8900, nextDate: "14 Nov" };
}

export function ChangePlan({ confirm }: { confirm: (planId: string, interval: BillingInterval) => void }) {
  return <PlanPicker plans={plans} currentPlanId="team" quote={quote} onConfirm={confirm} />;
}

API reference

“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

TypeNotes
plansPickerPlan[] Yes–
currentPlanIdstring Yes–
currentIntervalBillingInterval No–
defaultSelectedstring NoWhich plan opens selected. Default: the current one. Set it when the picker is opened from an "Upgrade" button, so the customer lands on the plan they clicked with its charge already printed.
quote(planId: string, interval: BillingInterval) => PlanQuote YesAsked on every selection. Synchronous: fetch quotes up front, not on click.
onConfirm(planId: string, interval: BillingInterval, quote: PlanQuote) => void No–
currencystring No–
localestring No–
titlestring No–
footnotestring NoSmall print under the button. Default states that tax is extra.
lookLook NoLayered sets it in a tray, the heading above the card and the status in the strip below. Flat is one card.

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Liro foundations, installed alongside it

liro-themesegmented-control

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances

Used in a screenAll screens