Problem: Monthly/yearly switch.

Solution#

html
<div class="flex items-center justify-center gap-3 text-sm">
  <span>Monthly</span>
  <span class="h-6 w-11 rounded-full bg-blue-600 relative"><span class="absolute right-0.5 top-0.5 size-5 rounded-full bg-white"></span></span>
  <span class="text-slate-500">Yearly <span class="text-emerald-600 font-medium">-20%</span></span>
</div>

Why this works#

Decorative toggle + savings badge.

Variants#

  • Responsive: add screen prefixes to the core classes
  • Dark: pair each color utility with its dark: twin
  • Animated: add transition + a state variant for motion

cookbook/index|Cookbook index · utilities/index|Utilities reference · patterns/index|Layout patterns