cn is a drop-in replacement for the clsx plus tailwind-merge combo that almost every Tailwind codebase calls on every render. Same APIs, zero dependencies, and the README benchmarks the most common component call at 10 ns versus 320 ns for the old pair, with parity checked by 356,000 differential tests. It is maintained by shadcn and Aiden Bai, and a single shadcn CLI command migrates an existing project. The tradeoff: it targets Tailwind v4, so v3 projects should read the stated limitations first, and you are swapping a battle-tested library for a three-month-old one in a hot path. Framework-agnostic, works outside React, MIT, about 1.8k stars.
You are on Tailwind v4 and your components call cn() or twMerge() everywhere, especially in long lists or server-rendered pages.
You are still on Tailwind v3 or class merging never shows up in your profiles; the gain will not be worth the churn.
# Clone + explore: git clone https://github.com/shadcn-ui/cn cd cn # Then read the README below for setup steps.
Inferred from package · always double-check against the official README below.