Problem: Sidebar collapses on mobile.

Solution#

html
<div class="flex">
  <aside class="hidden lg:block w-64 shrink-0 border-r">nav</aside>
  <main class="flex-1 min-w-0">content</main>
</div>

Why this works#

hidden lg:block toggles the sidebar; min-w-0 on main prevents overflow blowups.

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