--- name: tailwind-ui-patterns description: Tailwind CSS v4 patterns, component styling, and responsive design license: MIT compatibility: tailwindcss 4+, react 18+, vite 6+ allowed-tools: read_file write_file apply_patch search_with_context --- # Tailwind UI Patterns ## Tailwind v4 Setup ```css /* app.css */ @import "tailwindcss"; /* Custom theme tokens */ @theme { --color-brand-50: oklch(0.97 0.01 250); --color-brand-500: oklch(0.55 0.15 250); --color-brand-900: oklch(0.25 0.08 250); --font-display: "Cal Sans", system-ui, sans-serif; --spacing-18: 4.5rem; } ``` ## Component Patterns ### Button Variants ```tsx const buttonVariants = { base: "inline-flex items-center justify-center font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", variant: { primary: "bg-brand-500 text-white hover:bg-brand-600 focus-visible:ring-brand-500", secondary: "bg-gray-100 text-gray-900 hover:bg-gray-200 focus-visible:ring-gray-500", outline: "border border-gray-300 bg-transparent hover:bg-gray-50 focus-visible:ring-gray-500", ghost: "hover:bg-gray-100 focus-visible:ring-gray-500", destructive: "bg-red-500 text-white hover:bg-red-600 focus-visible:ring-red-500", }, size: { sm: "h-8 px-3 text-sm rounded-md", md: "h-10 px-4 text-sm rounded-lg", lg: "h-12 px-6 text-base rounded-lg", icon: "h-10 w-10 rounded-lg", }, }; function Button({ variant = "primary", size = "md", className, ...props }) { return ( ); } ``` ### Card Component ```tsx function Card({ className, ...props }) { return (
); } function CardHeader({ className, ...props }) { return ; } function CardContent({ className, ...props }) { return ; } function CardFooter({ className, ...props }) { return ( ); } ``` ### Input with Label ```tsx function FormField({ label, error, children, className }) { return ({error}
)}Body text that scales appropriately
``` ### Container Queries ```tsx{description}
Adaptive text