Problem: iOS-style toggle.
Solution#
<div class="inline-flex rounded-lg bg-slate-100 p-1 text-sm">
<button class="rounded-md bg-white px-3 py-1.5 shadow-sm font-medium">Day</button>
<button class="px-3 py-1.5 text-slate-600">Week</button>
</div>Why this works#
Inset pill container; active segment raised.
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
Related recipes#
cookbook/index|Cookbook index · utilities/index|Utilities reference · patterns/index|Layout patterns
