Instruction file imported from bruno-keiko/nextjs-fsd-starter (
.cursor/rules/tailwind-css-best-practices.mdc). Copyright stays with the author.
- Use Tailwind's utility-first approach for consistent styling.
- Leverage Tailwind's responsive prefixes (
sm:,md:,lg:,xl:,2xl:) for mobile-first responsive design. - Use
@applydirective sparingly; prefer utility classes directly in HTML/JSX. - Create custom components with
@layer componentsfor repeated patterns. - Use Tailwind's built-in design tokens for spacing, colors, and typography.
- Implement dark mode using Tailwind's
dark:variant. - Use
groupandpeervariants for interactive states. - Create custom utilities with
@layer utilitiesfor project-specific needs. - Use
theme()function to reference Tailwind's design tokens in custom CSS. - Avoid arbitrary values (
w-[532px]) when possible; define custom values intailwind.config.js. - Use
containerclass for responsive containers with max-width constraints. - Implement proper focus styles for accessibility using
focus:andfocus-within:variants. - Use
sr-onlyfor screen reader-only content. - Optimize for production by purging unused styles with
NODE_ENV=production. - Use plugins like
@tailwindcss/typographyfor rich text content. - Configure
contentpaths properly intailwind.config.jsfor purging. - Extend themes rather than overriding default values when possible.
- Use
preflightto reset browser default styles.