Skip to main content

Migrating

The cva package (v1+) is the successor to class-variance-authority (v0.x). It ships new features — compose and defineConfig — and changes the cva() call signature from positional arguments to a config object.

Package rename

The class-variance-authority package is no longer receiving new features. Migrate to cva to access compose, defineConfig, and future releases.
1

Uninstall the legacy package

2

Install the new package

3

Update imports

Replace all imports from class-variance-authority with cva.
4

Update cva() call signatures

The legacy package accepted two positional arguments: cva(base, options). The new package accepts a single config object: cva({ base, variants, compoundVariants, defaultVariants }).
This is a breaking change. Every cva() call must be updated.
Before (class-variance-authority v0.x)
After (cva v1+)
The diff in one place:

New features in cva v1+

compose

compose is a new helper that merges multiple CVA components into one. It is not available in class-variance-authority.
See the compose API reference for full documentation.

defineConfig

defineConfig lets you configure a custom onComplete hook that runs after every class concatenation — the primary use case is integrating tailwind-merge globally:
lib/utils.ts
See the defineConfig API reference for full documentation.