# Class Variance Authority

> A tiny library for building type-safe, variant-driven class names with Tailwind CSS or any other styling approach

Source: https://talira.ai/catalog/class-variance-authority-x7mgegwq
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [frontend / css / class variants](https://talira.ai/categories/frontend/css/class-variants)
- Licence: Apache-2.0[^2]
- Pricing: Free and open source[^1]
- Pricing notes: Free and open source under Apache-2.0; the author takes sponsors.
- Free tier: yes[^1]
- Self-hostable: yes[^1]
- Supports: [llms.txt](https://talira.ai/standards/llms-txt.md)[^3]
- Backed by: [Joe Bell](https://talira.ai/orgs/joe-bell.md)
- Creator: Joe Bell

Class Variance Authority (cva) builds a component's class names from its variants: you declare base classes, variants such as intent and size, default variants and compound variants that apply when several conditions match, and get a function that returns the right class string for the props you pass, with TypeScript types for them. It works with [Tailwind CSS](https://talira.ai/catalog/tailwind-css-wfchsr5n.md) or any other styling approach (plain CSS, BEM, CSS Modules) and in React, Vue, Svelte, Astro or 11ty, giving the type-safe variants of CSS-in-TS libraries such as [vanilla-extract](https://talira.ai/catalog/vanilla-extract-f6hkm8zf.md) while you keep control of your stylesheet. Version 1.0, in beta as the `cva` package, adds first-class composition. It's Apache-2.0 and privately maintained by Joe Bell.

## Links

- Website: https://cva.style/
- GitHub: https://github.com/joe-bell/cva
- Docs: https://cva.style/docs

## Problems it solves

- manually matching CSS classes to component props for every variant is tedious and error-prone
- typed variant props for our Tailwind components without a CSS-in-JS library
- apply extra classes only when a component has two variants at once, like primary and large
- keep full control of our stylesheet but still get Stitches-style variants
- the same variant logic for components written with BEM classes or CSS Modules
- set default variants so most call sites don't pass every prop

## Features

- variants, default variants and compound variants that resolve to class names
- TypeScript types for variant props
- works with Tailwind CSS, plain CSS, BEM and CSS Modules
- examples for React, Vue, Svelte, Astro and 11ty
- extending and composing components; first-class composition with composes in the 1.0 beta
- llms.txt and Markdown copies of the docs

## Trust

Overall: 0.35 out of 1.
Signals: backing 0.50, extensibility 0.00.

- backed by Joe Bell
- created by Joe Bell

Warnings:

- GitHub activity not fetched yet

## Alternatives

- [Tailwind Variants](https://talira.ai/catalog/tailwind-variants-82kre1qs.md): A first-class variant API for Tailwind CSS

## Sources

[^1]: https://cva.style/docs (checked 22 Nov 2026)
[^2]: https://github.com/joe-bell/cva/blob/main/LICENSE (checked 22 Nov 2026)
[^3]: https://cva.style/llms.txt (checked 22 Nov 2026)
