Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Centered Billing Period Toggle Hero Block for React

A centered single-plan hero with a monthly and annual switch under the headline, then one band split by a hairline: the price beside a Shine Button, and six included features.

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

A centered pricing hero for a product with one plan. A headline and a sentence sit over a segmented Monthly and Annual switch, with a badge on Annual showing the saving. Below, a band runs from rail to rail, split by a hairline with a + mark where it meets the top rule: on one side the price rolls digit by digit to its new amount, with a line saying how it's billed, a full-width Shine Button as the one primary action and a trust line; on the other side six checked features in two columns. On a phone the band stacks, the price first. It's built from Guides, Segment Group, Badge, Sliding Number and Shine Button, with Lucide check icons and CSS transitions only. The fictional product is Kiln, a build pipeline tool. For single-plan SaaS products, indie apps, creator tools and any business whose pricing fits in one sentence.

FAQ

How do I change the price and what's included?

Edit the constants at the top of the file: CURRENCY, MONTHLY_PRICE and ANNUAL_PRICE (the monthly price when billed annually), and FEATURES for the checklist. The saving on the Annual badge and the yearly total under the price are computed from the two prices, so they always match: with $29 and $24 the badge says 17% and the line says $288 billed once a year.

How does the price change, and does it work without JavaScript?

The price is our Sliding Number: the server renders the real monthly price, and when the period changes only the digits that differ roll to their new values, so the width barely moves and nothing counts up on load. The line under it swaps between Billed monthly and the yearly total in the same space, so the button below never moves.

How do screen readers hear the switch and the price?

The switch is our Segment Group, a radio group named Billing period: the arrow keys change the period, and the Annual option reads as Annual, save 17%. The price and the billing line sit in a polite live region, so after a change a screen reader reads the new price as, for example, $24 per month, $288 billed once a year. The headline is the page's one h1.

How do I send the chosen period to checkout?

Start free trial is a link to #. Build its href from the selected period, for example /checkout?billing=annual, or read the period when the button is pressed and create your checkout session with the matching price. Keep the period in the state the switch already uses, so the price shown and the price charged come from the same value.

What moves, and what happens with reduced motion?

On load, the headline, the switch and the band fade and rise into place one after another. The switch's background slides to the chosen period, and the price's digits roll. It's all CSS, with no animation library. With reduced motion, everything is in place from the start, the switch's background jumps, and the price changes at once.

When should I use a billing toggle instead of plan cards side by side?

Use this hero when you sell one plan with two ways to pay: the toggle keeps the page about the product, with a single price and a single decision. When you have several tiers whose features differ, show them as plan cards side by side, as the Centered Plan Card Pair hero or a pricing section does, so visitors can compare them.

  • Pro

    A compact centered hero that leads with its one price: a launch pill, a headline and a sentence, then the price in a hairline frame beside a Shine Button and three trust points.

  • Pro

    A centered pricing hero with Free and Pro side by side in one hairline band, the Pro cell tinted and holding the Shine Button, and a plan switch on phones.

  • Pro

    A showcase hero for a single plan: the headline and the price in a card in card, over a grid of eight included features that share their hairlines.

  • Pro

    Split Panel Comparison Hero

    Features and tables

    A split hero for a status-page product: the headline and two calls to action beside a comparison table against a self-hosted page, in a hairline frame.

  • Pro

    Hero With Stats

    Stats and live data

    A split hero with a headline, a Shine Button and a second action beside a rail of four key figures on shared hairlines, each with its period and a small bar trend.

  • Pro

    A compact centred hero with a role switch in a band that swaps the headline, the subtitle and a band of three checklist cells for designers, engineers and product teams.