--- id: Gentleman-Programming/Gentleman-Skills/tailwind-4 version: "b37f6614" license: MIT install: manual updated: 2026-03-28 --- # tailwind-4 — Tailwind-4 guides you through Tailwind CSS 4 conventions and patterns for modern styling. Learn when to apply cn() for conditional classes, leverage semantic color and spacing utilities, and handle dynamic values with the style prop. The skill covers flexbox, grid, responsive design, dark mode, and proper handling of library integrations that don't accept className. Publisher: Gentleman-Programming · Stars: 604 · Updated: 2026-03-28 Install (manual): `git clone https://github.com/Gentleman-Programming/Gentleman-Skills` ## SKILL.md ## Styling Decision Tree ``` Tailwind class exists? → className="..." Dynamic value? → style={{ width: `${x}%` }} Conditional styles? → cn("base", condition && "variant") Static only? → className="..." (no cn() needed) Library can't use class?→ style prop with var() constants ``` ## Critical Rules ### Never Use var() in className ```typescript // ❌ NEVER: var() in className
// ✅ ALWAYS: Use Tailwind semantic classes
``` ### Never Use Hex Colors ```typescript // ❌ NEVER: Hex colors in className

// ✅ ALWAYS: Use Tailwind color classes

``` ## The cn() Utility ```typescript import { clsx } from "clsx"; import { twMerge } from "tailwind-merge"; export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } ``` ### When to Use cn() ```typescript // ✅ Conditional classes
// ✅ Merging with potential conflicts