Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

Class Variance Authority

Type-safe CSS class composition for component variants and styling.

UI components and iconsNPM

GitHubWebsite

1. License

License from npm.

github.com/joe-bell/cva

From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error

What Class Variance Authority does

cva brings the variants API that the site credits Stitches with pioneering to plain class strings, so projects on Tailwind CSS or hand-written CSS get typed variant props without a CSS-in-TS library.

Class Variance Authority popularity

80 / 100
Gid Score, #91 overall
88.5M
downloads a week, npm
6,917
GitHub stars
1,020
agent projects use it
Class Variance Authority: downloads per weeknpm, class-variance-authority 88,498,018
Class Variance Authority: GitHub starsjoe-bell/cva 6,917

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How Class Variance Authority is used

  • Class Variance Authority is a dependency in 1,020 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (21.0% of the 4,867 JavaScript/TypeScript ones), #2 of 230 in ui components and icons.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 3,835; those are left out of every share on this page.
  • Projects that use it most often also use Tailwind Merge (98.3%), clsx (97.9%), Lucide React (92.2%).
  • It is more common in projects set up for Roo Code (27.9%) than for OpenAI Codex (13.9%).

By coding agent

523 projects, 21.4%
519 projects, 15.8%
454 projects, 15.0%
76 projects, 16.0%
65 projects, 13.9%
58 projects, 20.8%
55 projects, 16.0%
31 projects, 27.9%

Often used with

In 98.3% of its projects
In 97.9% of its projects
In 92.2% of its projects
In 74.8% of its projects
In 99.3% of its projects
In 95.9% of its projects
In 64.8% of its projects
In 53.9% of its projects

Class Variance Authority in practice

Strengths

Typed variants for people who skip CSS-in-TS

The site says CSS-in-TS libraries such as Stitches and Vanilla Extract handle type-safe variants. It pitches cva at people who need control over stylesheet output, use Tailwind CSS, or prefer writing their own CSS.

Component props typed from the cva config

In one developer's design system, the Button's prop type is built with <code>VariantProps&lt;typeof buttonVariants&gt;</code>, where <code>buttonVariants</code> is the cva definition with <code>variant</code> and <code>size</code> options.

596 B on the site's stats panel

The site lists a size of 596 B, minified and compressed with Brotli. It sits in the stats area next to the per-package download figures, so it most likely refers to one package rather than both.

clsx handles class flattening

The maintainers write that an earlier custom <code>cx</code> utility could not handle variadic arguments or objects. They switched to clsx, which added those features with "quite literally zero increase to the bundle size."

Watch out for

Latest release is still 0.x

The releases page lists v0.7.1, published 2024-11-26, as the latest release. The site banner says cva@1.0 is in beta.

Two package names while 1.0 is in beta

The stable package is <code>class-variance-authority</code> and the beta is <code>cva</code>. They have separate docs, and the abridged LLM bundle covers the stable docs only.

Privately maintained, asks for sponsors

The site calls cva "a privately-maintained free open-source project" and asks for sponsorship to fund development.

More about Class Variance Authority

Funding
  • GitHub Sponsors: https://github.com/joe-bell
  • Polar: https://polar.sh/cva

See all

Packages around it
  • tailwind-merge: Tailwind class conflict merging
  • clsx: Conditional className strings
  • lucide-react: Icon components
  • @radix-ui: Unstyled UI primitives
  • tailwindcss: Utility-first CSS
  • next-themes: Theme switching
More in UI components and icons

Alternatives

Class Variance Authority This page

Apache-2.0Gid 8088.5M/wk

Compare Class Variance Authority with another tool

Get started

Install it.

npm install class-variance-authority

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## Class Variance Authority
- The docs cover two packages: `class-variance-authority` (stable) and `cva` (the 1.0 beta, documented at https://cva.style/beta). Check which one the project already depends on before writing imports.
- The site says cva works "with Tailwind CSS or any other styling approach", so it can be used with plain CSS class names as well as Tailwind utilities.
- For stable docs only, fetch `https://cva.style/llms-small.txt`. For stable plus beta, fetch `https://cva.style/llms-full.txt`. The beta alone has `https://cva.style/_llms-txt/cvabeta.txt`.
- To read a single page as Markdown, add `.md` to its path without a trailing slash (home pages: `/index.md`, `/beta/index.md`), or send `Accept: text/markdown`.
- Suggested pattern, taken from a community example rather than the official docs: type component props with `VariantProps<typeof buttonVariants>` and pass the cva result plus `className` through a merge helper (`cn(buttonVariants({ variant, size }), className)`).