{
 "kind": "tool",
 "slug": "class-variance-authority",
 "path": "tools/class-variance-authority/",
 "name": "Class Variance Authority",
 "maker": null,
 "density": "profile",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "UI components and icons",
   "tools/ui-components/"
  ]
 ],
 "lead": "Type-safe CSS class composition for component variants and styling.",
 "chips": [
  {
   "label": "UI components and icons",
   "path": "tools/ui-components/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install class-variance-authority"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/joe-bell/cva"
  },
  {
   "label": "Website",
   "href": "https://github.com/joe-bell/cva#readme"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "Apache-2.0",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": null,
   "note": "License from npm.",
   "src": "https://github.com/joe-bell/cva"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 23, 2026",
   "note": "Latest GitHub release Nov 26, 2024. ",
   "src": "https://github.com/joe-bell/cva"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "1,020 projects",
   "status": "info",
   "sub": "#2 of 230 in its category",
   "note": "Dependency in 1,020 public GitHub projects set up for AI coding agents that we scanned (16.3%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Docs for agents",
   "status": "yes",
   "sub": "llms.txt",
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": "https://cva.style/llms.txt"
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What Class Variance Authority does",
   "parts": [
    {
     "t": "prose",
     "text": "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."
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "Class Variance Authority popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "80",
       "of": "/ 100",
       "l": "Gid Score, #91 overall"
      },
      {
       "n": "88.5M",
       "l": "downloads a week, npm"
      },
      {
       "n": "6,917",
       "l": "GitHub stars"
      },
      {
       "n": "1,020",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How Class Variance Authority is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "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%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "523 projects, 21.4%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "519 projects, 15.8%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "454 projects, 15.0%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "76 projects, 16.0%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "65 projects, 13.9%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "58 projects, 20.8%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      },
      {
       "l": "55 projects, 16.0%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      },
      {
       "l": "31 projects, 27.9%",
       "v": "Roo Code",
       "path": "agents/roo-code/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 98.3% of its projects",
       "v": "Tailwind Merge",
       "path": "tools/tailwind-merge/"
      },
      {
       "l": "In 97.9% of its projects",
       "v": "clsx",
       "path": "tools/clsx/"
      },
      {
       "l": "In 92.2% of its projects",
       "v": "Lucide React",
       "path": "tools/lucide-react/"
      },
      {
       "l": "In 74.8% of its projects",
       "v": "Radix UI",
       "path": "tools/radix-ui/"
      },
      {
       "l": "In 99.3% of its projects",
       "v": "Tailwind CSS",
       "path": "tools/tailwindcss/"
      },
      {
       "l": "In 95.9% of its projects",
       "v": "React",
       "path": "tools/react/"
      },
      {
       "l": "In 64.8% of its projects",
       "v": "Next.js",
       "path": "tools/next/"
      },
      {
       "l": "In 53.9% of its projects",
       "v": "Sonner",
       "path": "tools/sonner/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "Class Variance Authority in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Typed variants for people who skip CSS-in-TS",
       "v": "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."
      },
      {
       "l": "Component props typed from the cva config",
       "v": "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."
      },
      {
       "l": "596 B on the site's stats panel",
       "v": "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."
      },
      {
       "l": "clsx handles class flattening",
       "v": "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.\""
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Latest release is still 0.x",
       "v": "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."
      },
      {
       "l": "Two package names while 1.0 is in beta",
       "v": "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."
      },
      {
       "l": "Privately maintained, asks for sponsors",
       "v": "The site calls cva \"a privately-maintained free open-source project\" and asks for sponsorship to fund development."
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about Class Variance Authority",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "GitHub Sponsors: https://github.com/joe-bell",
        "Polar: https://polar.sh/cva"
       ]
      },
      {
       "title": "Packages around it",
       "items": [
        "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"
       ]
      },
      {
       "title": "More in UI components and icons",
       "path": "tools/ui-components/",
       "items": [
        {
         "text": "Lucide React",
         "path": "tools/lucide-react/"
        },
        {
         "text": "Radix UI",
         "path": "tools/radix-ui/"
        },
        {
         "text": "Sonner",
         "path": "tools/sonner/"
        },
        {
         "text": "cmdk",
         "path": "tools/cmdk/"
        },
        {
         "text": "React Day Picker",
         "path": "tools/react-day-picker/"
        },
        {
         "text": "Vaul",
         "path": "tools/vaul/"
        },
        {
         "text": "react-resizable-panels",
         "path": "tools/react-resizable-panels/"
        },
        {
         "text": "shadcn/ui",
         "path": "tools/shadcn/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "Class Variance Authority",
       "me": true,
       "facts": [
        "Apache-2.0",
        "Gid 80",
        "88.5M/wk"
       ]
      }
     ],
     "more": "Compare Class Variance Authority with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "install",
     "intro": "Install it.",
     "code": "npm install class-variance-authority"
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## Class Variance Authority\n- 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.\n- 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.\n- 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`.\n- 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`.\n- 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)`).\n"
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm class-variance-authority"
  ],
  [
   "Category",
   "UI components and icons"
  ],
  [
   "License",
   "Apache-2.0"
  ],
  [
   "Latest version",
   "v0.7.1, November 26, 2024"
  ],
  [
   "On GitHub since",
   "January 2022"
  ],
  [
   "Gid Score",
   "80.5"
  ],
  [
   "Rank in category",
   "#2 of 230"
  ],
  [
   "GitHub",
   "joe-bell/cva"
  ],
  [
   "Last change",
   "Nov 23, 2026"
  ]
 ],
 "good": [],
 "checked_line": "From the package registry, GitHub and our scan of public agent projects; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/joe-bell.png"
}