Skip to content

Billing Period Toggle

A monthly/yearly billing toggle with a sliding knob and a "save 20%" hint badge.

Billing Period Toggle

by FreeCsStyles Dev's

PricingModern
🌐
#billing#toggle#save#period

Embed this component

Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/billing-toggle.

<iframe src="/embed/billing-toggle" sandbox="allow-scripts" loading="lazy" title="Billing Period Toggle" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>

Implementation code

Copy the HTML and CSS for Billing Period Toggle. The HTML and CSS variants are self-contained; framework variants assume that framework's project setup.

HTML
<div class="billing-wrap">
  <div class="billing-toggle">
    <span class="billing-label">Monthly</span>
    <label class="billing-switch">
      <input type="checkbox" checked>
      <span class="billing-slider"></span>
    </label>
    <span class="billing-label active">Yearly</span>
    <span class="save-badge">Save 20%</span>
  </div>
  <div class="billing-price">
    <span class="old-price">$348 / yr</span>
    <span class="new-price">$278 / yr</span>
  </div>
</div>
CSS
.billing-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }

.billing-toggle { display: flex; align-items: center; gap: 12px; }

.billing-label { font-size: 14px; font-weight: 600; color: rgba(255, 255, 255, 0.5); }
.billing-label.active { color: #fff; font-weight: 700; }

.billing-switch { cursor: pointer; }

.billing-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.billing-slider {
  display: block;
  width: 58px;
  height: 30px;
  border-radius: 999px;
  padding: 3px;
  background: linear-gradient(135deg, #8b5cf6, #06b6d4);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
  position: relative;
  transition: background 0.3s ease;
}

.billing-slider::after {
  content: "";
  position: absolute;
  right: 28px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: right 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

input:not(:checked) ~ .billing-slider::after { right: 3px; }
input:not(:checked) ~ .billing-slider { background: rgba(255, 255, 255, 0.15); }

.save-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.old-price { font-size: 12px; color: rgba(255, 255, 255, 0.3); text-decoration: line-through; }
.new-price { font-size: 12px; color: #22c55e; font-weight: 700; }

Where Billing Period Toggle fits

  • SaaS Plans
  • Price Switchers
  • Subscriptions

Topics

  • #billing
  • #toggle
  • #save
  • #period