Installation
Add utilities
Set up the standard class merging helper (cn) using clsx and tailwind-merge.
1
Install class merging dependencies
Add clsx for conditional class resolution and tailwind-merge to clean up conflicting utility overrides.
pnpm add clsx tailwind-merge2
Create utils helper
Create a lib/utils.ts file and paste the helper function code below.
lib/utils.ts
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}