--- name: tailwind-patterns description: Tailwind CSS v4 patterns, component styling, dark mode, responsive design, and design system integration. Use when styling components or reviewing CSS. --- # Tailwind Patterns ## Core Approach - Utility-first: compose classes, don't write custom CSS - Extract components, not classes (use React components, not `@apply`) - Consistent spacing/color via design tokens ## Component Patterns ### Button Variants ```tsx const buttonVariants = { primary: 'bg-blue-600 hover:bg-blue-700 text-white', secondary: 'bg-gray-100 hover:bg-gray-200 text-gray-900', danger: 'bg-red-600 hover:bg-red-700 text-white', ghost: 'hover:bg-gray-100 text-gray-700', } interface ButtonProps { variant?: keyof typeof buttonVariants size?: 'sm' | 'md' | 'lg' children: React.ReactNode } export const Button = ({ variant = 'primary', size = 'md', children }: ButtonProps) => { const sizes = { sm: 'px-3 py-1.5 text-sm', md: 'px-4 py-2', lg: 'px-6 py-3 text-lg' } return ( ) } ``` ### Responsive Design ```tsx // Mobile-first approach
Secondary text