forms@Ibelick
Use cn() Utility for Class Merging
MUST
MUST: Use cn utility (clsx + tailwind-merge) for conditional class logic. Handles class conflicts, falsy values, and array inputs cleanly.
Always use the cn() utility (clsx + tailwind-merge) for conditional and merged class names
Bad
Good
Why it matters
From the Stack constraints in ibelick's baseline-ui skill. Naive string concatenation leaves both sides of a conflict in the class list (p-4 and p-2), and the winner is decided by stylesheet order, not by intent. cn() combines clsx for conditional logic with tailwind-merge for last-one-wins conflict resolution.
References