Skip to content

ever-co/ever-works / .agents/skills/tailwind-css-patterns

tailwind-css-patterns

Verified

Provides comprehensive Tailwind CSS utility-first styling patterns including responsive design, layout utilities, flexbox, grid, spacing, typography, colors, and modern CSS best practices. Use when styling React/Vue/Svelte components, building responsive layouts, implementing design systems, or optimizing CSS workflow.

references/component-patterns.md

View on GitHub
# Tailwind CSS Component Patterns

## Card Component

```html
<div class="bg-white rounded-lg shadow-lg overflow-hidden">
	<img class="w-full h-48 object-cover" src="image.jpg" alt="Card image" />
	<div class="p-6">
		<h3 class="text-xl font-bold mb-2">Card Title</h3>
		<p class="text-gray-700 mb-4">Card description text goes here.</p>
		<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">Action</button>
	</div>
</div>
```

## Responsive User Card

```html
<div class="max-w-sm mx-auto bg-white rounded-xl shadow-lg overflow-hidden sm:flex sm:max-w-2xl">
	<img class="h-48 w-full object-cover sm:h-auto sm:w-48" src="profile.jpg" alt="Profile" />
	<div class="p-8">
		<div class="uppercase tracking-wide text-sm text-indigo-500 font-semibold">Product Engineer</div>
		<h2 class="mt-1 text-xl font-semibold text-gray-900">John Doe</h2>
		<p class="mt-2 text-gray-500">Building amazing products with modern technology.</p>
		<button class="mt-4 px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition">
			Contact
		</button>
	</div>
</div>
```

## Navigation Bar

```html
<nav class="bg-white shadow-lg">
	<div class="container mx-auto px-4">
		<div class="flex justify-between items-center h-16">
			<div class="flex items-center">
				<a href="#" class="text-xl font-bold text-gray-800">Logo</a>
			</div>
			<div class="hidden md:flex space-x-8">
				<a href="#" class="text-gray-700 hover:text-blue-600 transition">Home</a>
				<a href="#" class="text-gray-700 hover:text-blue-600 transition">About</a>
				<a href="#" class="text-gray-700 hover:text-blue-600 transition">Services</a>
				<a href="#" class="text-gray-700 hover:text-blue-600 transition">Contact</a>
			</div>
			<button class="md:hidden">
				<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
					<path
						stroke-linecap="round"
						stroke-linejoin="round"
						stroke-width="2"
						d="M4 6h16M4 12h16M4 18h16"
					></path>
				</svg>
			</button>
		</div>
	</div>
</nav>
```

## Form Elements

```html
<form class="space-y-6 max-w-md mx-auto">
	<div>
		<label class="block text-sm font-medium text-gray-700 mb-2"> Email </label>
		<input
			type="email"
			class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
			placeholder="you@example.com"
		/>
	</div>

	<div>
		<label class="block text-sm font-medium text-gray-700 mb-2"> Password </label>
		<input
			type="password"
			class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
		/>
	</div>

	<div class="flex items-center">
		<input type="checkbox" class="mr-2" />
		<label class="text-sm text-gray-600">Remember me</label>
	</div>

	<button
		type="submit"
		class="w-full bg-blue-600 text-white font-semibold py-2 px-4 rounded-lg hover:bg-blue-700 transition"
	>
		Sign In
	</button>
</form>
```

## Modal/Dialog

```html
<div class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4">
	<div class="bg-white rounded-lg shadow-xl max-w-md w-full p-6">
		<div class="flex justify-between items-center mb-4">
			<h3 class="text-xl font-bold">Modal Title</h3>
			<button class="text-gray-500 hover:text-gray-700">
				<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
					<path
						stroke-linecap="round"
						stroke-linejoin="round"
						stroke-width="2"
						d="M6 18L18 6M6 6l12 12"
					></path>
				</svg>
			</button>
		</div>
		<p class="text-gray-700 mb-6">Modal content goes here.</p>
		<div class="flex justify-end space-x-4">
			<button class="px-4 py-2 text-gray-600 hover:text-gray-800">Cancel</button>
			<button class="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700">Confirm</button>
		</div>
	</div>
</div>
```

## React Button Component with Variants

```tsx
import { useState } from 'react';

function Button({
	variant = 'primary',
	size = 'md',
	children
}: {
	variant?: 'primary' | 'secondary';
	size?: 'sm' | 'md' | 'lg';
	children: React.ReactNode;
}) {
	const baseClasses = 'font-semibold rounded transition';

	const variantClasses = {
		primary: 'bg-blue-600 text-white hover:bg-blue-700',
		secondary: 'bg-gray-200 text-gray-800 hover:bg-gray-300'
	};

	const sizeClasses = {
		sm: 'px-3 py-1 text-sm',
		md: 'px-4 py-2 text-base',
		lg: 'px-6 py-3 text-lg'
	};

	return <button className={`${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]}`}>{children}</button>;
}
```
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 319kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 196kUpdated Claude CodeCodexVerifiedInstall