46.6 million weekly downloads
Across all packages
| Package | Downloads |
|---|---|
| class-variance-authority | 45.3M |
| cva@beta | 1.3M |

cva is a tiny library for building type-safe, variant-driven class names with Tailwind CSS or any other styling approach.
CSS-in-TS libraries such as Stitches and Vanilla Extract handle type-safe UI variants without you managing class names or stylesheet composition by hand.
CSS-in-TS isn’t for everyone, though. You may need full control over your stylesheet output, use a framework such as Tailwind CSS, or prefer writing your own CSS.
Creating variants with the “traditional” CSS approach can become an arduous task: manually matching classes to props, and manually adding types.
cva takes away those pain points, so you can focus on building your UI.
46.6 million weekly downloads
| Package | Downloads |
|---|---|
| class-variance-authority | 45.3M |
| cva@beta | 1.3M |
580 B
variants API movement: your open-source contributions are immensely appreciatedcva first appeared in cx, a type-safe class concatenation utility with reusable shortcuts, in October 2020.cva began with the intention of merging into the wonderful clb library, but after some discussion with Bill, we felt a separate project made more sense.cx utility for flattening classes, but it lacked the ability to handle variadic arguments or objects. clsx provided those extra features with quite literally zero increase to the bundle size: a no-brainer to switch!