Skip to content
IndexRequest a UIAboutContact

Pricing Toggle Card

A plan card with a Monthly/Yearly switch; the price rolls to the new value and a savings badge appears.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Design a pricing plan card for "Pro" with a billing switch above the price. A pill switch (role switch, aria-checked) labelled "Monthly" and "Yearly" toggles billing; when Yearly is on, a small green badge "Save 20%" scales in next to the label. The large price shows "$12" per month for Monthly and "$9.60" per month for Yearly, with the line "Billed $115.20 yearly" beneath it in grey; the number animates (counts) to the new value over about 350 milliseconds using tabular numerals. Below, a list of three features with check icons and a near-black full-width "Choose Pro" button. Light card, 16 pixel radius, 1 pixel border, minimal style, prefers-reduced-motion fallback. Plain HTML, CSS and JavaScript.

About this pattern

Definition

A pricing card presents one plan with its price and features. A billing switch lets people compare monthly and yearly cost without leaving the card.

Purpose & UX principles

  • Show the effective monthly price for both options and say what is billed ("$115 billed yearly") so nothing is hidden.
  • Make the saving explicit with a small badge ("Save 20%"); animate the price briefly so the change is noticed.
  • The switch must be a real control with a label and role switch, reachable by keyboard.

Interaction states

  • Monthly (default), Yearly (badge visible), focus on switch, pressed.

Motion specification

  • The price counts to its new value over 350ms; the badge scales in 150ms.
  • Reduced motion: the price changes instantly and the badge appears without scaling.

Responsive behaviour

  • The card keeps a 280px max width; stack plan cards vertically on phones.
  • Price uses tabular numbers so digits do not jitter while animating.

Code

HTML
<div class="cd"><div class="hd"><span class="pl">Pro</span><span class="bd" id="bd" hidden>Save 20%</span></div>
<div class="sw"><span id="lm" class="on">Monthly</span><button id="tg" type="button" role="switch" aria-checked="false" aria-label="Bill yearly"><i></i></button><span id="ly">Yearly</span></div>
<div class="pr"><b id="pv">$12.00</b><span>/month</span></div><p class="bl" id="bl">Billed monthly</p>
<ul><li>Unlimited projects</li><li>Priority support</li><li>Export in any format</li></ul><button class="cta" type="button">Choose Pro</button></div>

Related patterns

Selectable Card

↗
Selectable CardCards & Containers

Toggle Switch

↗
Toggle SwitchInputs & Forms

Number Count Up

↗
Number Count UpData Visualization