Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Annual Savings Pricing Block for React

Three plans that show what yearly billing saves: each plan's head holds two bars, twelve monthly payments against one yearly payment, with the saving printed in the gap, under a monthly and yearly switch.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Show what paying yearly saves with this savings-led pricing section, written for Driftwood Notes, a note-taking app. The saving is the first thing you see: each of the three plans carries a small chart in its head, two bars of twelve monthly payments against one yearly payment, with the difference printed in the gap above the shorter bar. A Segment Group in the header row picks monthly or yearly billing; the bars' fill follows it, and each price rolls to its new amount with Sliding Number. The Pro cell is raised on a card background with a shadow, a Most popular outline Badge and the block's only primary Shine Button. Every cell is drawn apart by Guides, with hairlines that overshoot its corners and a + mark, under the page's top rule. Below lg one plan shows at a time, picked from a second Segment Group, with its features cut after five behind an "All 7 features" button. Built with Badge, Button, Guides, Segment Group, Shine Button, Sliding Number and Lucide icons, with CSS transitions only. For note-taking, productivity and any subscription whose yearly plan is the one you want people to pick.

FAQ

How do I change the plans, prices and savings?

Edit the PLANS array at the top of the file. Each plan has its name, description, monthly price (one month, paid monthly), yearly price (one year, paid once), features, the call to action's cta and href, featured for the raised plan, an optional badge, and perUser for a price written per user. You never type a saving: savedOf and percentOf work them out from the two prices, the gap in each chart shows the dollars, and the headline shows the largest percentage, so they stay right when a price changes. CURRENCY is the symbol written before every price.

How are the bars drawn, and what do they show?

The left bar is twelve monthly payments and always runs the full height; the right bar is the yearly payment, with its height set as a share of the left one through a CSS variable. The gap above it is an outlined box exactly as tall as the saving, so the bar and the gap always add up to the left bar. The switch changes the fill, not the heights: the bar for the period you picked is solid and the other is pale. The chart is decorative, so a screen reader skips it and reads a sentence instead: what twelve monthly payments cost, what one yearly payment costs and what the year saves.

How do I connect the plan buttons to checkout?

Each call to action is a real link to its plan's href: add the billing period to it, for example /checkout?plan=pro&billing=yearly, and let your server map the plan and period to your payment provider's price. Work the amount out again on the server; never trust a price sent from the page. It's a ShineButton with render set to an a element and nativeButton={false}.

How does it fit a phone?

Below lg the three cells collapse into one, so the first screen holds the header, a Plan switch and the chosen plan: its chart, price and call to action. The switch is a radio group named "Plan", Pro is selected first, and the plans you didn't pick are made invisible, not just faded, so nothing in them can take focus or be read; they keep their room, so switching plans moves nothing below. The feature list is cut after five items, with a button ("All 7 features") that has aria-expanded and opens the rest; Personal has exactly five, so it has no button.

Is the block accessible?

Yes. Both switches are radio groups, "Billing period" and "Plan": Tab reaches the selected option and the arrow keys move and select. Plans are h3 headings under the section's h2, features are lists, and each call to action names its plan ("Start free for 14 days, Pro plan"). Each price keeps its amount in text with "per month" or "per user per month" read out, and the featured plan is set apart by structure (a shadow, a badge, the filled button), not colour. Prices aren't a live region, so switching period doesn't interrupt a screen reader.

Why doesn't anything move when I switch the period?

The chart keeps its height and only changes fill, the digits are tabular, and the line under each price always takes one line (Billed yearly at $60 or Billed monthly, cancel anytime). On wide screens the three cells share their rows through CSS subgrid, so names, charts, prices, buttons and feature lists start on the same lines whatever the descriptions' lengths. Under reduced motion the prices change in place and the bars appear without growing.

  • Pro

    Billing Toggle Pricing

    Billing switches

    Three plan cards under a monthly and yearly switch that wears its saving in the header row, with prices that roll to their new amount and each plan a card in a card.

  • Pro

    Four big commitment chips, $500 to $50k a month, and in the same row the discount each earns at display size, over every unit's committed price against its on-demand price, with the call to action beside the result.

  • Pro

    Payment Schedule Pricing

    Billing switches

    Tuition paid once or in 3, 6 or 12 installments: four chips pick the schedule and a calendar of twelve monthly cells fills with the dated payments and their amounts, over the total and the call to action.

  • Pro

    The canonical three-column pricing section for a team knowledge base: Personal, Team and Company cells under a monthly and yearly switch, each outlined by hairlines that overshoot its corners, the recommended plan raised, one plan at a time on phones.

  • Pro

    A split pricing section for a VPN with a contract length slider from 1 to 24 months in a card in a card, where the monthly price at display size, the discount, total and savings roll to each term, and a sticky bar on phones.

  • Pro

    Comparison Table Pricing

    Comparison tables

    Four plans compared feature by feature in one table whose hairlines meet the page rails, with a billing switch, a tinted popular column and, on a phone, a plan switch that keeps the feature column beside one plan.