Home › All rules › Community › Tailwind Cursor Rules

Tailwind Cursor Rules

Tailwind CSS and UI component best practices for modern web applications

CursorTailwind CSSCommunity (CC0)

How to use

Save this as .cursor/rules/tailwind.mdc in your project, commit it, and Cursor will load it. Review it first: community files can be opinionated or out of date.

Note: Review and test before use. Provided as is, without warranty. See Terms.

.cursor/rules/tailwind.mdcDownload  
---
description: "Tailwind CSS and UI component best practices for modern web applications"
globs: **/*.css, **/*.tsx, **/*.jsx, tailwind.config.js, tailwind.config.ts
alwaysApply: false
---
# Tailwind CSS Best Practices

## Project Setup
- Use proper Tailwind configuration
- Configure theme extension properly
- Set up proper purge configuration
- Use proper plugin integration
- Configure custom spacing and breakpoints
- Set up proper color palette

## Component Styling
- Use utility classes over custom CSS
- Group related utilities with @apply when needed
- Use proper responsive design utilities
- Implement dark mode properly
- Use proper state variants
- Keep component styles consistent

## Layout
- Use Flexbox and Grid utilities effectively
- Implement proper spacing system
- Use container queries when needed
- Implement proper responsive breakpoints
- Use proper padding and margin utilities
- Implement proper alignment utilities

## Typography
- Use proper font size utilities
- Implement proper line height
- Use proper font weight utilities
- Configure custom fonts properly
- Use proper text alignment
- Implement proper text decoration

## Colors
- Use semantic color naming
- Implement proper color contrast
- Use opacity utilities effectively
- Configure custom colors properly
- Use proper gradient utilities
- Implement proper hover states

## Components
- Use shadcn/ui components when available
- Extend components properly
- Keep component variants consistent
- Implement proper animations
- Use proper transition utilities
- Keep accessibility in mind

## Responsive Design
- Use mobile-first approach
- Implement proper breakpoints
- Use container queries effectively
- Handle different screen sizes properly
- Implement proper responsive typography
- Use proper responsive spacing

## Performance
- Use proper purge configuration
- Minimize custom CSS
- Use proper caching strategies
- Implement proper code splitting
- Optimize for production
- Monitor bundle size

## Best Practices
- Follow naming conventions
- Keep styles organized
- Use proper documentation
- Implement proper testing
- Follow accessibility guidelines
- Use proper version control

More: Tailwind CSS rules · all community rules

Related rules

Tailwind CSS .claude/rules file

A path-scoped Claude Code rules file (.claude/rules) for Tailwind v4 styling in component files.

Claude Code (CLAUDE.md)Tailwind CSS

Tailwind CSS v4 rules

Cursor rules for Tailwind CSS v4: CSS-first config with @theme, @utility and @custom-variant, the Vite plugin, and tokens.

CursorTailwind CSS

Tailwind CSS v4 rules

Windsurf rules for clean, consistent, accessible Tailwind CSS v4 styling.

WindsurfTailwind CSS

Html Tailwind Css JavaScript Cursor Rules

Cursor rules for HTML development with Tailwind CSS and JavaScript integration.

CursorTailwind CSSCommunity (CC0)

Tailwind Shadcn Ui Integration Cursor Rules

Cursor rules for Tailwind development with shadcn/ui integration.

CursorTailwind CSSCommunity (CC0)

TypeScript Vite Tailwind Cursor Rules

Cursor rules for TypeScript development with Vite and Tailwind integration.

CursorTailwind CSSCommunity (CC0)

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.