Components / Selects and toggles
Billing period switch
A two way switch between monthly and yearly that swaps the price and the small print above it. For pricing where the period changes the number.
Unlimited classes · Kiln Street Yoga
$118$98a month
Billed each month. Pause or cancel any time.Billed as $1,176 once a year, mat hire included.
Monthly
Yearly
Save $240
The code
Plain HTML and CSS on your kit's variables. Put it next to tokens/variables.css from your kit's files and it draws in your look.
<div class="ukc-toggle-billing-period">
<div class="bp">
<p class="k">Unlimited classes · Kiln Street Yoga</p>
<p class="price"><span class="m">$118</span><span class="y">$98</span><small>a month</small></p>
<p class="note" aria-live="polite"><span class="m">Billed each month. Pause or cancel any time.</span><span class="y">Billed as $1,176 once a year, mat hire included.</span></p>
<div class="sw">
<span class="l lm">Monthly</span>
<label class="track"><input type="checkbox" role="switch" checked aria-label="Bill yearly"><i></i></label>
<span class="l ly">Yearly</span>
<span class="save">Save $240</span>
</div>
</div>
</div>
.ukc-toggle-billing-period { position: relative; font-family: var(--uk-font-body, system-ui, sans-serif); color: var(--uk-ink); font-size: 15px; line-height: 1.5;
--tint: color-mix(in srgb, var(--uk-accent) 12%, var(--uk-paper));
--tint-strong: color-mix(in srgb, var(--uk-accent) 22%, var(--uk-paper));
--accent-deep: color-mix(in srgb, var(--uk-accent) 72%, black);
--ink-soft: color-mix(in srgb, var(--uk-ink) 8%, var(--uk-paper));
--line-strong: color-mix(in srgb, var(--uk-ink) 32%, var(--uk-paper));
--danger-tint: color-mix(in srgb, var(--uk-danger) 12%, var(--uk-paper));
--high-tint: color-mix(in srgb, var(--uk-highlight) 28%, var(--uk-paper)); }
.ukc-toggle-billing-period *, .ukc-toggle-billing-period *::before, .ukc-toggle-billing-period *::after { box-sizing: border-box; }
.ukc-toggle-billing-period :where(h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote) { margin: 0; }
.ukc-toggle-billing-period :where(ul, ol) { padding: 0; list-style: none; }
.ukc-toggle-billing-period :where(button, input, select, textarea) { font: inherit; color: inherit; }
.ukc-toggle-billing-period :where(a) { color: inherit; }
.ukc-toggle-billing-period svg { flex: none; }
.ukc-toggle-billing-period .bp { max-width: 340px; display: grid; gap: 6px; padding: 22px; border: var(--uk-border-width) solid var(--uk-line); border-radius: var(--uk-radius-lg); background: var(--uk-paper); }
.ukc-toggle-billing-period .k { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--uk-muted); }
.ukc-toggle-billing-period .price { display: flex; align-items: baseline; gap: 8px; font-family: var(--uk-font-display, inherit); font-size: 52px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ukc-toggle-billing-period .price small { font-family: var(--uk-font-body, inherit); font-size: 14px; color: var(--uk-muted); }
.ukc-toggle-billing-period .note { min-height: 42px; font-size: 14px; color: var(--uk-muted); }
.ukc-toggle-billing-period:has(.track input:checked) .m, .ukc-toggle-billing-period:not(:has(.track input:checked)) .y { display: none; }
.ukc-toggle-billing-period .sw { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--uk-line); font-size: 14px; }
.ukc-toggle-billing-period .l { color: var(--uk-muted); }
.ukc-toggle-billing-period:has(.track input:checked) .ly, .ukc-toggle-billing-period:not(:has(.track input:checked)) .lm { color: var(--uk-ink); font-weight: 700; }
.ukc-toggle-billing-period .track { position: relative; flex: none; width: 46px; height: 26px; border-radius: 999px; background: var(--uk-ink); cursor: pointer; }
.ukc-toggle-billing-period .track input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
.ukc-toggle-billing-period .track i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 999px; background: var(--uk-paper); transition: transform var(--uk-motion-duration) var(--uk-motion-ease); }
.ukc-toggle-billing-period .track input:checked + i { transform: translateX(20px); }
.ukc-toggle-billing-period .track:has(input:focus-visible) { outline: 2px solid var(--uk-accent); outline-offset: 3px; }
.ukc-toggle-billing-period .save { margin-left: auto; padding: 1px 8px; border: 1px solid var(--uk-ink); border-radius: var(--uk-radius-sm); font-size: 12px; font-weight: 600; }
.ukc-toggle-billing-period:not(:has(.track input:checked)) .save { border-style: dashed; border-color: var(--line-strong); color: var(--uk-muted); font-weight: 400; }
@media (prefers-reduced-motion: reduce) { .ukc-toggle-billing-period .track i { transition: none; } }
More selects and toggles
All 28- Email notificationsWeekly digest
Auto-send invoices
OnRound hours up
Off