# Class Variance Authority — card for AI agents

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

Category: UI components and icons · npm package `class-variance-authority` · latest version 0.7.1 (checked 2026-11-01)
Install: `npm install class-variance-authority`
License: Apache-2.0 (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (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` and pass the cva result plus `className` through a merge helper (`cn(buttonVariants({ variant, size }), className)`).

## Docs written for agents
- [llms.txt (index of the docs)](https://cva.style/llms.txt)

## What it is
- Class Variance Authority (cva) builds class names from variants. You give it base classes, named variants and default values. It returns the class string that matches a set of props. The site calls it "a tiny library for building type-safe, variant-driven class names with Tailwind CSS or any other styling approach."
- The site says CSS-in-TS libraries such as Stitches and Vanilla Extract already handle type-safe variants. It aims cva at people who want that but do not use CSS-in-TS: people who need full control over stylesheet output, use Tailwind CSS, or write their own CSS.
- The GitHub README has no usage docs. It points to cva.style and states the Apache-2.0 license, © Joe Bell. The docs cover the stable `class-variance-authority` package and the `cva` beta package, and they are also published as plain-text bundles and Markdown pages for language models.

## Caveats
- 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 `class-variance-authority` and the beta is `cva`. 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.

## Numbers (AgentGid data)
- Gid Score: 80.5 (#91 of all tools, 6 of 230 in its category)
- Used in 1,020 public projects set up for AI coding agents (16.3%)
- Downloads last week: 88,498,018 (as of 2026-11-24), +26.9% over 4 weeks
- GitHub stars: 6,917 (as of 2026-11-24)
- Last push: 2026-11-23

## Often used with
Tailwind Merge 98.3%, clsx 97.9%, Lucide React 92.2%, Radix UI 74.8%, Tailwind CSS 99.3%, React 95.9%

## Links
- AgentGid page: https://agentgid.com/tools/class-variance-authority/
- Homepage: https://github.com/joe-bell/cva#readme
- Repository: https://github.com/joe-bell/cva
- Source: https://github.com/joe-bell/cva#readme
- Source: https://github.com/joe-bell/cva
- Source: https://github.com/joe-bell/cva/releases
- Source: https://cva.style
- Source: https://cva.style/llms.txt

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
