{
  "id": "pricing-toggle-card",
  "name": "Pricing Toggle Card",
  "category": "cards",
  "tags": [
    "pricing",
    "monthly yearly",
    "billing toggle",
    "has",
    "radio",
    "discount"
  ],
  "description": "A pricing card with a monthly/yearly switch that swaps the price using radio buttons and :has().",
  "url": "https://copy-css.com/snippets/pricing-toggle-card",
  "markdown": "https://copy-css.com/snippets/pricing-toggle-card.md",
  "html": "<article class=\"price-switch\">\n  <fieldset class=\"price-switch-toggle\">\n    <legend>Billing period</legend>\n    <label><input type=\"radio\" name=\"period\" value=\"monthly\" checked> Monthly</label>\n    <label><input type=\"radio\" name=\"period\" value=\"yearly\"> Yearly <em>−20%</em></label>\n  </fieldset>\n  <p class=\"price-switch-amount\">\n    <span class=\"price-switch-monthly\">$15</span>\n    <span class=\"price-switch-yearly\">$12</span>\n    <small>per month</small>\n  </p>\n  <a href=\"#\">Get started</a>\n</article>",
  "css": ".price-switch {\n  width: 240px;\n  padding: 18px;\n  border-radius: 18px;\n  background: #fff;\n  box-shadow: 0 10px 30px -12px rgba(20, 83, 45, 0.3);\n  color: #14532d;\n  font-family: system-ui, sans-serif;\n  text-align: center;\n}\n\n.price-switch-toggle {\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n  margin: 0;\n  padding: 4px;\n  border: 0;\n  border-radius: 999px;\n  background: #dcfce7;\n}\n\n.price-switch-toggle legend {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  overflow: hidden;\n  clip-path: inset(50%);\n}\n\n.price-switch-toggle label {\n  padding: 7px 4px;\n  border-radius: 999px;\n  font-size: 13px;\n  font-weight: 600;\n  cursor: pointer;\n  transition: background 0.2s ease;\n}\n\n.price-switch-toggle input {\n  position: absolute;\n  opacity: 0;\n}\n\n.price-switch-toggle label:has(:checked) {\n  background: #fff;\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);\n}\n\n.price-switch-toggle label:has(:focus-visible) {\n  outline: 2px solid #16a34a;\n  outline-offset: 1px;\n}\n\n.price-switch-toggle em {\n  color: #16a34a;\n  font-size: 11px;\n  font-style: normal;\n}\n\n.price-switch-amount {\n  margin: 14px 0;\n}\n\n.price-switch-amount span {\n  font-size: 40px;\n  font-weight: 800;\n}\n\n.price-switch-amount small {\n  display: block;\n  color: #4d7c5f;\n  font-size: 13px;\n}\n\n.price-switch-yearly,\n.price-switch:has([value=\"yearly\"]:checked) .price-switch-monthly {\n  display: none;\n}\n\n.price-switch:has([value=\"yearly\"]:checked) .price-switch-yearly {\n  display: inline;\n}\n\n.price-switch > a {\n  display: block;\n  padding: 10px;\n  border-radius: 10px;\n  background: #16a34a;\n  color: #fff;\n  font-size: 14px;\n  font-weight: 700;\n  text-decoration: none;\n}\n\n.price-switch > a:focus-visible {\n  outline: 2px solid #14532d;\n  outline-offset: 2px;\n}",
  "features": [
    "transitions",
    "box shadows",
    "clip paths",
    "CSS Grid",
    "the :has() selector",
    "the :checked state (no JavaScript)",
    "keyboard focus styles"
  ],
  "customProperties": []
}
