Tool Open source

cn

cn is a JavaScript engine for conditionally joining Tailwind CSS class names and resolving conflicting utilities. It is a drop-in replacement for clsx and tailwind-merge, preserving their APIs and output semantics while learning repeated variadic call sequences so stable calls can skip redundant work.

View repository Mentioned in 2 videos ↓

Overview

The package has no dependencies and is framework-agnostic, running in browsers, Node, Bun, Deno, edge runtimes, and server templates for frameworks including React, Vue, Svelte, Solid, and Astro. It supports configurable Tailwind class groups, prefixes, themes, and validators through cn/config, and includes a CLI for build-time processing and a lighter strings-only variant. It is maintained by aidenybai and shadcn.

What cn is used for

2 uses taken from transcripts — each links to the moment in the video.

  • A drop-in engine for merging Tailwind CSS classes and resolving conflicts. It keeps the same API as Tailwind Merge, has no dependencies, works across multiple frameworks and runtimes, and learns repeated call sequences to avoid redundant work.

  • A zero-dependency replacement for combining CLSX with Tailwind merge. It provides familiar APIs, works across frameworks and runtimes, and supports custom Tailwind configurations.

Videos mentioning cn

2 in the library.