1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
|
# Tailwind CSS Claude Code Configuration ๐จ
A comprehensive Claude Code configuration for building beautiful, responsive, and performant user interfaces with Tailwind CSS, utility-first styling, and modern design systems.
## โจ Features
This configuration provides:
- **Utility-first CSS mastery** with Tailwind's complete toolkit
- **Responsive design patterns** with mobile-first methodology
- **Design system architecture** with custom colors, spacing, and typography
- **Component composition patterns** using utility classes
- **Dark mode implementation** with seamless theming
- **Performance optimization** with CSS purging and minimal bundles
- **Animation and motion** utilities for engaging interfaces
- **Accessibility best practices** with focus management and semantic HTML
## ๐ฆ Installation
1. Copy the `.claude` directory to your project root:
```bash
cp -r tailwindcss/.claude your-project/
cp tailwindcss/CLAUDE.md your-project/
```
2. Install Tailwind CSS in your project:
```bash
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
# Optional: Install additional plugins
npm install -D @tailwindcss/typography @tailwindcss/forms @tailwindcss/aspect-ratio @tailwindcss/container-queries
```
3. The configuration will be automatically loaded when you start Claude Code in your project.
## ๐ฏ What You Get
### Tailwind CSS Expertise
- **Utility-first methodology** - Building complex components with simple utilities
- **Responsive design mastery** - Mobile-first approach with consistent breakpoints
- **Design system creation** - Custom colors, spacing, typography, and component tokens
- **Performance optimization** - CSS purging, minimal bundles, and efficient styling
- **Dark mode implementation** - Seamless theming with class-based or CSS variable approaches
- **Component patterns** - Reusable utility compositions for common UI elements
### Key Development Areas
| Area | Coverage |
|------|----------|
| **Layout** | Flexbox, Grid, Container queries, Responsive design |
| **Typography** | Font families, sizes, weights, line heights, text styles |
| **Colors** | Custom palettes, semantic tokens, dark mode, opacity |
| **Spacing** | Margin, padding, gap, custom scale, responsive spacing |
| **Borders** | Radius, width, colors, shadows, outlines |
| **Animations** | Transitions, transforms, keyframes, micro-interactions |
| **Components** | Buttons, forms, cards, navigation, complex UI patterns |
| **Performance** | Purging, optimization, bundle size, loading strategies |
## ๐ Quick Start Examples
### Basic Configuration
```javascript
// tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./app/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {
colors: {
brand: {
50: '#f0f9ff',
500: '#0ea5e9',
900: '#0c4a6e',
}
}
},
},
plugins: [],
}
```
### Component Examples
```jsx
// Button Component with Variants
function Button({ children, variant = 'primary', size = 'md' }) {
const baseClasses = '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';
const variants = {
primary: 'bg-brand-600 text-white hover:bg-brand-700',
secondary: 'bg-gray-100 text-gray-900 hover:bg-gray-200',
outline: 'border border-gray-300 bg-transparent hover:bg-gray-50',
};
const sizes = {
sm: 'h-8 px-3 text-sm',
md: 'h-10 px-4',
lg: 'h-11 px-6 text-lg',
};
return (
<button className={`${baseClasses} ${variants[variant]} ${sizes[size]}`}>
{children}
</button>
);
}
// Responsive Card Component
function Card({ children, hover = false }) {
return (
<div className={`
rounded-lg border border-gray-200 bg-white p-6 shadow-sm
dark:border-gray-800 dark:bg-gray-900
${hover ? 'transition-shadow hover:shadow-md' : ''}
`}>
{children}
</div>
);
}
```
### Responsive Design
```jsx
// Mobile-First Responsive Layout
function ResponsiveLayout() {
return (
<div className="
px-4 py-8
sm:px-6 sm:py-12
md:px-8 md:py-16
lg:px-12 lg:py-20
xl:px-16 xl:py-24
">
<div className="
mx-auto max-w-sm
sm:max-w-md
md:max-w-lg
lg:max-w-4xl
xl:max-w-6xl
">
<h1 className="
text-2xl font-bold
sm:text-3xl
md:text-4xl
lg:text-5xl
xl:text-6xl
">
Responsive Typography
</h1>
</div>
</div>
);
}
```
## ๐ง Configuration Patterns
### Design System Setup
```javascript
// Advanced Tailwind configuration
module.exports = {
darkMode: 'class',
theme: {
extend: {
colors: {
// Custom brand colors
brand: {
50: '#f0f9ff',
100: '#e0f2fe',
200: '#bae6fd',
500: '#0ea5e9',
600: '#0284c7',
900: '#0c4a6e',
},
// Semantic colors using CSS variables
background: 'hsl(var(--background))',
foreground: 'hsl(var(--foreground))',
primary: {
DEFAULT: 'hsl(var(--primary))',
foreground: 'hsl(var(--primary-foreground))',
},
},
fontFamily: {
sans: ['Inter', 'system-ui', 'sans-serif'],
mono: ['JetBrains Mono', 'Consolas', 'monospace'],
},
animation: {
'fade-in': 'fadeIn 0.5s ease-in-out',
'slide-up': 'slideUp 0.3s ease-out',
'bounce-gentle': 'bounceGentle 2s infinite',
},
keyframes: {
fadeIn: {
'0%': { opacity: '0' },
'100%': { opacity: '1' },
},
slideUp: {
'0%': { transform: 'translateY(10px)', opacity: '0' },
'100%': { transform: 'translateY(0)', opacity: '1' },
},
},
},
},
plugins: [
require('@tailwindcss/typography'),
require('@tailwindcss/forms'),
require('@tailwindcss/aspect-ratio'),
],
}
```
### CSS Variables for Theming
```css
/* globals.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--primary: 221.2 83.2% 53.3%;
--primary-foreground: 210 40% 98%;
}
.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;
--primary: 217.2 91.2% 59.8%;
--primary-foreground: 222.2 84% 4.9%;
}
}
@layer components {
.btn {
@apply inline-flex items-center justify-center rounded-md px-4 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50;
}
.card {
@apply rounded-lg border border-gray-200 bg-white p-6 shadow-sm dark:border-gray-800 dark:bg-gray-900;
}
}
```
## ๐ Dark Mode Implementation
### Class-Based Dark Mode
```jsx
// Theme toggle component
function ThemeToggle() {
const [theme, setTheme] = useState('light');
const toggleTheme = () => {
const newTheme = theme === 'light' ? 'dark' : 'light';
setTheme(newTheme);
document.documentElement.classList.toggle('dark');
};
return (
<button
onClick={toggleTheme}
className="
rounded-lg p-2 transition-colors
hover:bg-gray-100 dark:hover:bg-gray-800
focus:outline-none focus:ring-2 focus:ring-brand-500
"
>
{theme === 'light' ? '๐' : 'โ๏ธ'}
</button>
);
}
// Dark mode aware components
function DarkModeCard({ children }) {
return (
<div className="
rounded-lg border bg-white p-6 shadow-sm
border-gray-200 dark:border-gray-700
dark:bg-gray-800 dark:text-white
">
{children}
</div>
);
}
```
## ๐ฑ Responsive Patterns
### Responsive Grid Systems
```jsx
// Auto-responsive grid
function ResponsiveGrid({ children }) {
return (
<div className="
grid gap-6
grid-cols-1
sm:grid-cols-2
lg:grid-cols-3
xl:grid-cols-4
">
{children}
</div>
);
}
// Container queries for component-level responsiveness
function ContainerAwareCard() {
return (
<div className="@container">
<div className="
p-4
@md:p-6
@lg:p-8
">
<h3 className="
text-lg
@md:text-xl
@lg:text-2xl
">
Container Query Title
</h3>
</div>
</div>
);
}
```
### Responsive Navigation
```jsx
// Mobile-first navigation
function Navigation() {
const [isOpen, setIsOpen] = useState(false);
return (
<nav className="bg-white shadow-sm">
<div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
<div className="flex h-16 justify-between">
{/* Logo */}
<div className="flex items-center">
<img className="h-8 w-8" src="/logo.svg" alt="Logo" />
</div>
{/* Desktop Navigation */}
<div className="hidden md:flex md:items-center md:space-x-8">
<a href="/" className="text-gray-700 hover:text-brand-600">Home</a>
<a href="/about" className="text-gray-700 hover:text-brand-600">About</a>
<a href="/contact" className="text-gray-700 hover:text-brand-600">Contact</a>
</div>
{/* Mobile menu button */}
<div className="md:hidden">
<button
onClick={() => setIsOpen(!isOpen)}
className="text-gray-700 hover:text-brand-600"
>
โฐ
</button>
</div>
</div>
{/* Mobile Navigation */}
{isOpen && (
<div className="md:hidden">
<div className="space-y-1 px-2 pb-3 pt-2">
<a href="/" className="block px-3 py-2 text-gray-700">Home</a>
<a href="/about" className="block px-3 py-2 text-gray-700">About</a>
<a href="/contact" className="block px-3 py-2 text-gray-700">Contact</a>
</div>
</div>
)}
</div>
</nav>
);
}
```
## ๐ฌ Animation and Motion
### Custom Animations
```jsx
// Staggered animation list
function StaggeredList({ items }) {
return (
<div className="space-y-4">
{items.map((item, index) => (
<div
key={item.id}
className={`
animate-fade-in opacity-0
[animation-delay:${index * 100}ms]
[animation-fill-mode:forwards]
`}
>
{item.content}
</div>
))}
</div>
);
}
// Interactive hover effects
function InteractiveCard({ children }) {
return (
<div className="
group cursor-pointer overflow-hidden rounded-lg bg-white shadow-sm
transition-all duration-300 hover:shadow-lg hover:-translate-y-1
">
<div className="
h-48 bg-gradient-to-r from-blue-500 to-purple-600
transition-transform duration-300 group-hover:scale-105
" />
<div className="p-6">
{children}
</div>
</div>
);
}
```
### Loading States
```jsx
// Skeleton loading components
function SkeletonCard() {
return (
<div className="animate-pulse rounded-lg border border-gray-200 p-6">
<div className="h-4 bg-gray-200 rounded w-3/4 mb-4"></div>
<div className="h-4 bg-gray-200 rounded w-1/2 mb-2"></div>
<div className="h-4 bg-gray-200 rounded w-5/6"></div>
</div>
);
}
// Spinner component
function Spinner({ size = 'md' }) {
const sizes = {
sm: 'h-4 w-4',
md: 'h-8 w-8',
lg: 'h-12 w-12',
};
return (
<div className={`${sizes[size]} animate-spin rounded-full border-2 border-gray-300 border-t-brand-600`} />
);
}
```
## ๐ Performance Optimization
### Content Optimization
```javascript
// Optimized content configuration
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./app/**/*.{js,ts,jsx,tsx,mdx}',
],
safelist: [
// Dynamic classes that might be purged incorrectly
{
pattern: /bg-(red|green|blue)-(100|500|900)/,
variants: ['hover', 'focus'],
},
],
blocklist: [
// Classes to never include
'container',
'collapsible',
],
}
```
### Bundle Size Optimization
```javascript
// Plugin configuration for smaller bundles
module.exports = {
plugins: [
require('@tailwindcss/typography')({
className: 'prose',
target: 'modern', // Smaller bundle size
}),
require('@tailwindcss/forms')({
strategy: 'class', // Only include when using form-* classes
}),
],
corePlugins: {
// Disable unused core plugins
container: false,
accessibility: false,
},
}
```
## ๐งช Testing Integration
### Component Testing with Tailwind Classes
```jsx
// Testing utility classes
import { render, screen } from '@testing-library/react';
describe('Button Component', () => {
it('applies correct styling classes', () => {
render(<Button variant="primary">Click me</Button>);
const button = screen.getByRole('button');
expect(button).toHaveClass('bg-brand-600', 'text-white', 'hover:bg-brand-700');
});
it('responds to different screen sizes', () => {
render(<ResponsiveCard />);
const card = screen.getByTestId('card');
expect(card).toHaveClass('p-4', 'md:p-6', 'lg:p-8');
});
});
```
### Visual Regression Testing
```javascript
// Storybook configuration for visual testing
export default {
title: 'Components/Button',
component: Button,
parameters: {
viewport: {
viewports: {
mobile: { name: 'Mobile', styles: { width: '375px', height: '667px' } },
tablet: { name: 'Tablet', styles: { width: '768px', height: '1024px' } },
desktop: { name: 'Desktop', styles: { width: '1024px', height: '768px' } },
},
},
},
};
export const AllVariants = () => (
<div className="space-y-4">
<Button variant="primary">Primary Button</Button>
<Button variant="secondary">Secondary Button</Button>
<Button variant="outline">Outline Button</Button>
</div>
);
```
## ๐ Integration
This configuration works seamlessly with:
- **Next.js 15** - App Router and Server Components styling
- **React/Vue/Svelte** - Component-based architectures
- **shadcn/ui** - Pre-built accessible components
- **Headless UI** - Unstyled, accessible UI primitives
- **Framer Motion** - Animation library integration
- **Storybook** - Component documentation and testing
## ๐ Resources
- [Tailwind CSS Documentation](https://tailwindcss.com/docs)
- [Tailwind UI Components](https://tailwindui.com)
- [Headless UI](https://headlessui.com)
- [Heroicons](https://heroicons.com)
- [Tailwind Play](https://play.tailwindcss.com) - Online playground
- [Tailwind Community](https://github.com/tailwindlabs/tailwindcss/discussions)
- [Awesome Tailwind CSS](https://github.com/aniftyco/awesome-tailwindcss)
## ๐จ Design Resources
- [Color palette generators](https://tailwindcss.com/docs/customizing-colors)
- [Typography scale calculator](https://type-scale.com)
- [Spacing scale reference](https://tailwindcss.com/docs/customizing-spacing)
- [Component examples](https://tailwindcomponents.com)
- [Templates and themes](https://tailwindtemplates.co)
---
**Ready to build stunning, responsive interfaces with Claude Code and Tailwind CSS!**
๐ **Star this configuration** if it accelerates your UI development workflow!
|