Tailwind CSS Best Practices

Tailwind CSS Best Practices

Gives Cursor a Tailwind CSS best-practices rule set covering setup, layout, typography, colours, responsive design, dark mode and shadcn/ui components.


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

Public domain (CC0 1.0) · by awesome-cursorrules contributors · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…