Skip to main content

Signature

Parameters

ClassValue[]
Any number of class values: strings, arrays, objects, undefined, null, or false.

Returns

A merged class string, or undefined if the result is empty.

Example

How It Works

cn combines clsx for conditional classes with tailwind-merge for conflict resolution.

When to Use

Most of the time, you won’t need cn() directly — styled() handles class merging for you. Use it when you need to merge classes outside of a styled component: