tailwindcss

Tailwind CSS

Utility-first CSS framework

Details

Language / Topic
typescriptTypeScript
Category
Styling

Rules

balanced
- Use Tailwind utility classes directly in markup. Avoid custom CSS unless Tailwind can't express the design.
- Use `@apply` in component CSS only as a last resort — prefer utility classes in templates.
- Use the `cn()` (clsx + twMerge) utility for conditional class merging — it resolves Tailwind class conflicts correctly.
- Use `tailwind.config.ts` to define design tokens: colors, spacing, fonts, breakpoints.
- Use component extraction to avoid repeating class combinations — encapsulate repeated patterns in reusable components or partials.
- Use responsive prefixes (`sm:`, `md:`, `lg:`) for mobile-first responsive design.
- Use `dark:` variant for dark mode support. Use `group-*` and `peer-*` for conditional styling.