Cursor rules for Tailwind CSS development with responsive design, custom components, and dark mode.
.cursorrules in your project rootYou are an expert in Tailwind CSS and modern CSS practices.
## Class Organization
```jsx
// ā
Organize classes by category
<div className="
{/* Layout */}
flex flex-col items-center justify-center
{/* Sizing */}
w-full max-w-md min-h-screen
{/* Spacing */}
p-4 md:p-8 gap-4
{/* Typography */}
text-sm font-medium text-gray-900
{/* Background & Border */}
bg-white rounded-lg border border-gray-200
{/* Effects */}
shadow-lg hover:shadow-xl
{/* Transitions */}
transition-all duration-200
">
```
## Responsive Design
```jsx
// Mobile-first approach
<div className="
{/* Base (mobile) */}
grid grid-cols-1 gap-4 p-4
{/* Tablet */}
sm:grid-cols-2 sm:gap-6 sm:p-6
{/* Desktop */}
lg:grid-cols-3 lg:gap-8 lg:p-8
{/* Large desktop */}
xl:grid-cols-4
">
```
## Component Patterns
```jsx
// Button variants using CVA
import { cva, type VariantProps } from 'class-variance-authority';
const buttonVariants = cva(
// Base styles
'inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50',
{
variants: {
variant: {
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
ghost: 'hover:bg-accent hover:text-accent-foreground',
},
size: {
default: 'h-10 px-4 py-2',
sm: 'h-9 px-3 text-sm',
lg: 'h-11 px-8 text-lg',
icon: 'h-10 w-10',
},
},
defaultVariants: {
variant: 'default',
size: 'default',
},
}
);
```
## Dark Mode
```jsx
// Using class strategy
<div className="
bg-white dark:bg-gray-900
text-gray-900 dark:text-white
border-gray-200 dark:border-gray-700
">
// Toggle implementation
function ThemeToggle() {
const [theme, setTheme] = useState('light');
useEffect(() => {
document.documentElement.classList.toggle('dark', theme === 'dark');
}, [theme]);
return (
<button onClick={() => setTheme(t => t === 'light' ? 'dark' : 'light')}>
{theme === 'light' ? 'š' : 'āļø'}
</button>
);
}
```
## Custom Configuration
```javascript
// tailwind.config.js
module.exports = {
content: ['./src/**/*.{js,ts,jsx,tsx}'],
darkMode: 'class',
theme: {
extend: {
colors: {
primary: {
50: '#f0f9ff',
500: '#0ea5e9',
900: '#0c4a6e',
},
},
fontFamily: {
sans: ['Inter', 'sans-serif'],
mono: ['JetBrains Mono', 'monospace'],
},
animation: {
'fade-in': 'fadeIn 0.5s ease-out',
'slide-up': 'slideUp 0.3s ease-out',
},
keyframes: {
fadeIn: {
'0%': { opacity: '0' },
'100%': { opacity: '1' },
},
slideUp: {
'0%': { transform: 'translateY(10px)', opacity: '0' },
'100%': { transform: 'translateY(0)', opacity: '1' },
},
},
},
},
plugins: [
require('@tailwindcss/forms'),
require('@tailwindcss/typography'),
],
};
```Comprehensive Cursor rules for Next.js 14+ with App Router, including routing, layouts, and API patterns.
Cursor rules for TypeScript with strict type checking, advanced patterns, and best practices.
Comprehensive Cursor rules for React development with TypeScript, including hooks, components, and state management patterns.
Cursor
frontend
AI coding rules customize how Cursor generates and refactors code for your project. Follow these steps to install Tailwind CSS Best Practices.
.cursor/rules, for Windsurf use .windsurfrulesComprehensive Cursor rules for Next.js 14+ with App Router, including routing, layouts, and API patterns.
Cursor rules for TypeScript with strict type checking, advanced patterns, and best practices.
Comprehensive Cursor rules for React development with TypeScript, including hooks, components, and state management patterns.