Back to gallery
shadcn-ui/cn on GitHub — open-source project preview
shadcn-ui
Built byshadcn-ui/

cn

Stars
1.8k
Forks
0
Watchers
0
Open issues
0
main Updated 11 hours ago~1,767 stars/day lifetime
Editor's take

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.

Use this if

You are on Tailwind v4 and your components call cn() or twMerge() everywhere, especially in long lists or server-rendered pages.

Skip if

You are still on Tailwind v3 or class merging never shows up in your profiles; the gain will not be worth the churn.

UI ComponentsDesign Systems
Quick install
# 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.

Live data via GitHub REST API · Cached 30 min · Created 24 Nov 2026