Three-Plan Pricing Toggle
Three plans with a monthly/yearly switch, yearly prices derived from the monthly figure so the two can never disagree.
A native radiogroup of plans with the current one disabled and the prorated charge announced as it changes — the upgrade dialog, not the marketing table.
components/pricing-plan-picker.tsxnpx hoverlab add pricing-plan-picker
Or over MCP, from your editor's agent — no account needed.
Free to read, copy and install, for personal and non-commercial projects. Shipping it in client work or a paid product needs Pro ($79 once). The source lands in your repo and stops being ours — no attribution, nothing to upgrade.
Start a page with this section — add more, order them, and leave with the page source.
Changes take effect immediately. Downgrades credit the unused remainder against your next invoice.
Rendered live in your current theme — this is the same component whose source is below, not a screenshot of it.
'use client'
/**
* <PricingPlanPicker> — choosing a plan when the choosing is already decided.
*
* Every other pricing block in this catalog is a marketing surface: it is
* trying to persuade someone who has not committed. This one is for the
* screen after that — an upgrade dialog, a checkout step, the plan tab in
* settings — where the visitor has already decided to pay and now has to
* pick, and where a three-column table of feature bullets is an obstacle
* rather than an argument.
*
* So it is a form control, not a table. A radiogroup of rows, one line of
* differentiator each, the current plan marked and unselectable, a total
* that updates, and a single submit. The interaction the reader expects
* here is the one they get from every other form they have filled in, not
* the one they get from a pricing page.
*
* Built on real `<input type="radio">` with a shared `name`, wrapped in a
* `<fieldset>` with a `<legend>`. That gets arrow-key navigation, the
* roving tab stop, the group announcement and form submission for free and
* correctly. A `role="radiogroup"` reimplementation of the same thing with
* divs and key handlers is the most commonly broken widget on the web, and
* there is nothing here that native radios cannot already do.
*
* The current plan is disabled rather than hidden. Removing it loses the
* reader's anchor — they cannot see what they are moving *from*, which is
* the comparison they are actually making — and a disabled row with a
* "Current" tag says why it cannot be chosen instead of leaving a gap.
*
* The footer states the prorated consequence, not just the price. "You will
* be charged $34 today" is the number someone is about to have taken from
* their card, and a picker that shows only the sticker price is the reason
* upgrade flows generate support tickets.
*/
import * as React from 'react'
import { Check } from 'lucide-react'
export interface PickerPlan {
id: string
name: string
price: string
/** e.g. "per user, per month". Kept separate so the price stays large. */
cadence?: string
/** One line. This is a picker, not a comparison table. */
summary: string
/** Marks the row the workspace is already on. Rendered unselectable. */
current?: boolean
recommended?: boolean
}
export interface PricingPlanPickerProps {
legend?: string
heading?: string
plans?: PickerPlan[]
/** Per-plan line for the total, e.g. proration. Keyed by plan id. */
chargeToday?: Record<string, string>
submitLabel?: string
footnote?: string
className?: string
}
const DEFAULT_PLANS: PickerPlan[] = [
{
id: 'starter',
name: 'Starter',
price: '$0',
cadence: 'free forever',
summary: 'One project, community support, 60 API requests a minute.',
current: true,
},
{
id: 'pro',
name: 'Pro',
price: '$19',
cadence: 'per month',
summary: 'Unlimited projects, email support within one business day, 600 req/min.',
recommended: true,
},
{
id: 'team',
name: 'Team',
price: '$12',
cadence: 'per seat, per month',
summary: 'Everything in Pro for every seat, shared brand library, SSO.',
},
{
id: 'team-annual',
name: 'Team, annual',
price: '$120',
cadence: 'per seat, once a year',
summary: 'Ten months’ price for twelve months, billed once — nothing recurring to fail.',
},
]
const DEFAULT_CHARGE_TODAY: Record<string, string> = {
pro: '$12.67 today, prorated to the 21st',
team: '$8.00 today, prorated to the 21st',
'team-annual': '$120.00 today',
}
export function PricingPlanPicker({
legend = 'Choose a plan',
heading = 'Change your plan',
plans = DEFAULT_PLANS,
chargeToday = DEFAULT_CHARGE_TODAY,
submitLabel = 'Confirm change',
footnote = 'Changes take effect immediately. Downgrades credit the unused remainder against your next invoice.',
className = '',
}: PricingPlanPickerProps) {
/*
Per-instance prefix for every id this block emits.
The literals these replaced were a latent duplicate the moment the
block appeared twice on one document, and `aria-labelledby` on a
duplicated id resolves to the first match -- so the second copy was
labelled by the first copy's heading. Client component, so `useId` is
the right tool.
*/
const uid = React.useId()
const firstSelectable = plans.find((plan) => !plan.current)
const [selected, setSelected] = React.useState(firstSelectable?.id ?? '')
const charge = chargeToday[selected]
return (
<section
aria-labelledby={`${uid}-plan-picker-heading`}
className={`mx-auto w-full max-w-lg px-4 py-16 sm:px-6 ${className}`}
>
<div className="rounded-2xl border border-border/60 bg-card p-6 sm:p-8">
<h2
id={`${uid}-plan-picker-heading`}
className="text-xl font-bold tracking-tight text-foreground"
>
{heading}
</h2>
<form
onSubmit={(event) => event.preventDefault()}
className="mt-6"
>
<fieldset>
<legend className="sr-only">{legend}</legend>
<div className="space-y-3">
{plans.map((plan) => {
const checked = selected === plan.id
return (
<label
key={plan.id}
className={`flex cursor-pointer items-start gap-4 rounded-xl border p-4 transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring has-[:focus-visible]:ring-offset-2 has-[:focus-visible]:ring-offset-background ${
plan.current
? 'cursor-not-allowed border-border/60 bg-muted/40'
: checked
? 'border-primary bg-primary/5 ring-1 ring-primary'
: 'border-border/60 hover:border-border hover:bg-muted/40'
}`}
>
<input
type="radio"
name="plan"
value={plan.id}
checked={checked}
disabled={plan.current}
onChange={() => setSelected(plan.id)}
className="mt-1 h-4 w-4 shrink-0 accent-primary focus-visible:outline-none"
/>
<span className="min-w-0 flex-1">
<span className="flex flex-wrap items-baseline gap-x-2 gap-y-1">
<span className="font-semibold text-foreground">{plan.name}</span>
{plan.current ? (
<span className="rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground">
Current
</span>
) : null}
{plan.recommended ? (
<span className="rounded-full bg-primary/10 px-2 py-0.5 text-xs font-semibold text-primary">
Recommended
</span>
) : null}
</span>
<span className="mt-1 block break-words text-pretty text-sm leading-relaxed text-muted-foreground">
{plan.summary}
</span>
</span>
<span className="max-w-[40%] shrink-0 text-end">
<span className="block text-lg font-bold tabular-nums text-foreground">
{plan.price}
</span>
{plan.cadence ? (
<span className="mt-0.5 block break-words text-xs leading-snug text-muted-foreground">
{plan.cadence}
</span>
) : null}
</span>
</label>
)
})}
</div>
</fieldset>
{/* The number about to leave their account, announced when it
changes — a total that updates silently is one people miss. */}
<p
role="status"
className="mt-6 flex items-center gap-2 text-sm font-medium text-foreground"
>
{charge ? (
<>
<Check aria-hidden className="h-4 w-4 shrink-0 text-primary" />
{charge}
</>
) : null}
</p>
<button
type="submit"
disabled={!selected}
className="mt-4 inline-flex h-11 w-full items-center justify-center rounded-lg bg-primary px-5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
>
{submitLabel}
</button>
</form>
{footnote ? (
<p className="mt-4 text-pretty text-xs leading-relaxed text-muted-foreground">
{footnote}
</p>
) : null}
</div>
</section>
)
}
bg-card, text-muted-foreground) — it inherits your theme instead of overriding it.Drop it at components/pricing-plan-picker.tsx and import it where you need the section:
import { PricingPlanPicker } from '@/components/pricing-plan-picker'3 of this block’s props are simple enough to drive from here. Change them and the block below re-renders — it is the same component whose source is above, not a mock of it. Everything else it accepts is in the table underneath.
Read out of the component’s own type and signature, so this cannot drift from the source below. Every prop has a default — the component renders standalone before you pass it anything.
| Prop | Type | Default |
|---|---|---|
legend | string | 'Choose a plan' |
heading | string | 'Change your plan' |
plans | PickerPlan[] | DEFAULT_PLANS |
chargeTodayPer-plan line for the total, e.g. proration. Keyed by plan id. | Record<string, string> | DEFAULT_CHARGE_TODAY |
submitLabel | string | 'Confirm change' |
footnote | string | — |
className | string | '' |
The same block rendered once to markup, wrapped as a file your framework compiles. Tailwind classes are framework-agnostic, so the design transfers intact — the behaviour does not.
This block is interactive. The markup below is its initial state with the event handlers stripped — you will need to re-wire the behaviour in your framework.
<!--
In-App Plan Picker — markup from the Hoverlab catalog.
This is the block rendered once to HTML and wrapped as a component
file. It is not a port of the React source: the Tailwind classes carry
the design, which is the part that took the work, and they are the same
in every framework.
This block is interactive in React and the handlers are NOT here.
Buttons, toggles and menus render in their initial state and do
nothing until you wire them up.
-->
<section aria-labelledby="_R_0_-plan-picker-heading" class="mx-auto w-full max-w-lg px-4 py-16 sm:px-6 ">
<div class="rounded-2xl border border-border/60 bg-card p-6 sm:p-8">
<h2 id="_R_0_-plan-picker-heading" class="text-xl font-bold tracking-tight text-foreground">Change your plan</h2>
<form class="mt-6">
<fieldset>
<legend class="sr-only">Choose a plan</legend>
<div class="space-y-3">
<label class="flex cursor-pointer items-start gap-4 rounded-xl border p-4 transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring has-[:focus-visible]:ring-offset-2 has-[:focus-visible]:ring-offset-background cursor-not-allowed border-border/60 bg-muted/40">
<input type="radio" disabled="" class="mt-1 h-4 w-4 shrink-0 accent-primary focus-visible:outline-none" name="plan" value="starter" />
<span class="min-w-0 flex-1">
<span class="flex flex-wrap items-baseline gap-x-2 gap-y-1">
<span class="font-semibold text-foreground">Starter</span>
<span class="rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground">Current</span>
</span>
<span class="mt-1 block break-words text-pretty text-sm leading-relaxed text-muted-foreground">One project, community support, 60 API requests a minute.</span>
</span>
<span class="max-w-[40%] shrink-0 text-end">
<span class="block text-lg font-bold tabular-nums text-foreground">$0</span>
<span class="mt-0.5 block break-words text-xs leading-snug text-muted-foreground">free forever</span>
</span>
</label>
<label class="flex cursor-pointer items-start gap-4 rounded-xl border p-4 transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring has-[:focus-visible]:ring-offset-2 has-[:focus-visible]:ring-offset-background border-primary bg-primary/5 ring-1 ring-primary">
<input type="radio" class="mt-1 h-4 w-4 shrink-0 accent-primary focus-visible:outline-none" name="plan" checked="" value="pro" />
<span class="min-w-0 flex-1">
<span class="flex flex-wrap items-baseline gap-x-2 gap-y-1">
<span class="font-semibold text-foreground">Pro</span>
<span class="rounded-full bg-primary/10 px-2 py-0.5 text-xs font-semibold text-primary">Recommended</span>
</span>
<span class="mt-1 block break-words text-pretty text-sm leading-relaxed text-muted-foreground">Unlimited projects, email support within one business day, 600 req/min.</span>
</span>
<span class="max-w-[40%] shrink-0 text-end">
<span class="block text-lg font-bold tabular-nums text-foreground">$19</span>
<span class="mt-0.5 block break-words text-xs leading-snug text-muted-foreground">per month</span>
</span>
</label>
<label class="flex cursor-pointer items-start gap-4 rounded-xl border p-4 transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring has-[:focus-visible]:ring-offset-2 has-[:focus-visible]:ring-offset-background border-border/60 hover:border-border hover:bg-muted/40">
<input type="radio" class="mt-1 h-4 w-4 shrink-0 accent-primary focus-visible:outline-none" name="plan" value="team" />
<span class="min-w-0 flex-1">
<span class="flex flex-wrap items-baseline gap-x-2 gap-y-1">
<span class="font-semibold text-foreground">Team</span>
</span>
<span class="mt-1 block break-words text-pretty text-sm leading-relaxed text-muted-foreground">Everything in Pro for every seat, shared brand library, SSO.</span>
</span>
<span class="max-w-[40%] shrink-0 text-end">
<span class="block text-lg font-bold tabular-nums text-foreground">$12</span>
<span class="mt-0.5 block break-words text-xs leading-snug text-muted-foreground">per seat, per month</span>
</span>
</label>
<label class="flex cursor-pointer items-start gap-4 rounded-xl border p-4 transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring has-[:focus-visible]:ring-offset-2 has-[:focus-visible]:ring-offset-background border-border/60 hover:border-border hover:bg-muted/40">
<input type="radio" class="mt-1 h-4 w-4 shrink-0 accent-primary focus-visible:outline-none" name="plan" value="team-annual" />
<span class="min-w-0 flex-1">
<span class="flex flex-wrap items-baseline gap-x-2 gap-y-1">
<span class="font-semibold text-foreground">Team, annual</span>
</span>
<span class="mt-1 block break-words text-pretty text-sm leading-relaxed text-muted-foreground">Ten months’ price for twelve months, billed once — nothing recurring to fail.</span>
</span>
<span class="max-w-[40%] shrink-0 text-end">
<span class="block text-lg font-bold tabular-nums text-foreground">$120</span>
<span class="mt-0.5 block break-words text-xs leading-snug text-muted-foreground">per seat, once a year</span>
</span>
</label>
</div>
</fieldset>
<p role="status" class="mt-6 flex items-center gap-2 text-sm font-medium text-foreground"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check h-4 w-4 shrink-0 text-primary" aria-hidden="true"><path d="M20 6 9 17l-5-5"></path></svg>$12.67 today, prorated to the 21st</p>
<button type="submit" class="mt-4 inline-flex h-11 w-full items-center justify-center rounded-lg bg-primary px-5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background">Confirm change</button>
</form>
<p class="mt-4 text-pretty text-xs leading-relaxed text-muted-foreground">Changes take effect immediately. Downgrades credit the unused remainder against your next invoice.</p>
</div>
</section>
What each framework gets across the whole catalog — effects convert properly; this rung is markup.
The component, its props, the design tokens it expects and the command that installs it — as one prompt. Paste it into Claude, Cursor, v0 or ChatGPT and what they build around it will match the rest of the catalog instead of inventing its own system.
Want the whole screen instead of this one section? Open a page and copy it entire.
All of them free to read, copy and install — no account, no locked tiles, no watermarked preview. The whole catalog is open, and so are the API and the CLI.
Browse PricingCopying the code is free. Putting it in client work or a paid product is what Pro is for — the licence, not the access.
Three plans with a monthly/yearly switch, yearly prices derived from the monthly figure so the two can never disagree.
One price given a whole card, with the objection a one-time price raises answered under the button rather than in a FAQ further down.
A slider that turns a rate card into the number a buyer actually cares about, with a per-tier breakdown so the total can be checked rather than taken on trust.
A real table with scoped headers, a sticky first column and screen-reader text behind every check and dash.
One-time packs with the per-credit price worked out for the reader and the saving stated rather than implied — the pricing shape for a product that sells quantity, not a subscription.
The case for the price, made beside the price — what the alternative costs, in the units a buyer already measures.
What actually runs out on each plan, including what happens when it does — the row a pricing table leaves off.