Migrating
Thecva 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
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: After (cva v1+)The diff in one place:
cva(base, options). The new package accepts a single config object: cva({ base, variants, compoundVariants, defaultVariants }).Before (class-variance-authority v0.x)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.
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
defineConfig API reference for full documentation.