`cn`'s class merging logic for arbitrary `font-[...]` values, specifically its differentiation between `font-weight` and `font-family`.
Raw Developer Origin & Technical Request
GitHub Issue
Sep 3, 2026
`cn` classifies a bare arbitrary `font-[…]` value as font-weight regardless of content, while tailwind-merge (and Tailwind v4 itself) treats a non-numeric value as font-family. Found while running a differential of `cn` against `twMerge(clsx(...))` over a real codebase (28M comparisons; this and `@container*` were the only diverging groups).
**Versions:** cn 0.2.4, tailwind-merge 3.4.0, Node 22.
**Repro** (default config, `import { cn } from "cn"` vs `import { twMerge } from "tailwind-merge"`):
| input | tailwind-merge | cn |
|---|---|---|
| `font-sans font-[Inter]` | `font-[Inter]` | `font-sans font-[Inter]` |
| `font-[Inter] font-sans` | `font-sans` | `font-[Inter] font-sans` |
| `font-medium font-[Inter]` | `font-medium font-[Inter]` | `font-[Inter]` |
| `font-[Inter,sans-serif] font-bold` | `font-[Inter,sans-serif] font-bold` | `font-bold` |
Tailwind v4 compiles `font-[Inter]` to `font-family: Inter`, so the third and fourth rows drop a font-weight that should survive, and the first two keep a font-family that should be overridden. tailwind-merge's rule is: `font-[…]` is font-weight only when the value is an arbitrary number (or labelled `weight:`), otherwise font-family.
Related, opposite direction, and arguably a tailwind-merge bug rather than yours: for the labelled CSS-variable shorthand `font-(family-name:--f)`, `cn` correctly puts it in font-family while tailwind-merge's font-weight group swallows it first via its unlabelled `isArbitraryVariable` matcher:
| in...
Developer Debate & Comments
No active discussions extracted for this entry yet.
Adjacent Repository Pain Points
Other highly discussed features and pain points extracted from shadcn-ui/cn.
Frequently Asked Questions
Market intelligence mapped to `cn`'s class merging logic for arbitrary `font-[...]` values, specifically its differentiation between `font-weight` and `font-family`..
What problem does `cn`'s class merging logic for arbitrary `font-[...]` values, specifically its differentiation between `font-weight` and `font-family`. solve?
What are the foundational technologies related to `cn`'s class merging logic for arbitrary `font-[...]` values, specifically its differentiation between `font-weight` and `font-family`.?
Engagement Signals
Cross-Market Term Frequency
Quantifies the cross-market adoption of foundational terms like Tailwind v4 and Tailwind class merging by tracking occurrence frequency across active SaaS architectures and enterprise developer debates.
SaaS Metrics