--- name: tailwindcss description: Guide for implementing Tailwind CSS - a utility-first CSS framework for rapid UI development. Use when styling applications with responsive design, dark mode, custom themes, or building design systems with Tailwind's utility classes. license: MIT version: 1.0.0 --- # Tailwind CSS Skill Tailwind CSS is a utility-first CSS framework that enables rapid UI development by providing pre-built utility classes. It generates optimized CSS at build-time by scanning your project files, resulting in zero runtime overhead and minimal production bundles. ## When to Use This Skill Use this skill when: - Building responsive layouts with mobile-first design - Implementing dark mode and theme customization - Creating custom design systems with consistent spacing, colors, and typography - Styling React, Vue, Svelte, or any web framework components - Prototyping interfaces with rapid visual feedback - Building production applications with optimized CSS bundles - Working with state-based styling (hover, focus, disabled, etc.) - Creating complex layouts with Grid and Flexbox utilities ## Core Concepts ### Utility-First Approach Tailwind provides low-level utility classes that you apply directly to HTML elements instead of writing custom CSS: ```html
Text
Extra small
Small
Base (16px)
Large
Extra large
2XL
Light (300)
Normal (400)
Medium (500)
Semibold (600)
Bold (700)
``` **Text Alignment:** ```htmlLeft aligned
Center aligned
Right aligned
Justified
``` **Line Height:** ```htmlTight line height
Normal line height
Relaxed line height
``` **Combining font utilities:** ```htmlDark text
Blue text
Link ``` ### Borders ```htmlText changes when parent is hovered
Invalid email
``` ## Dark Mode ### Setup Dark Mode **Media query approach (automatic):** ```htmlText
Content adapts to theme
Custom font size
Custom tab size``` ### Custom Variants ```css @custom-variant theme-midnight (&:where([data-theme="midnight"] *)); @custom-variant aria-checked (&[aria-checked="true"]); ``` ```html
Card description text goes here