Loading homepage
Generate predictable class names from variant definitions, defaults, compound rules, and caller classes.
Input: const button = cva("btn", { variants: { size: { small: "text-sm", large: "text-lg" } }, defaultVariants: { size: "small" }, }); button(); button({ size: "large", className: "rounded" }); Output: "btn text-sm" and "btn text-lg rounded".
Input: cva("btn", { variants: { disabled: { true: "muted", false: "interactive" } }, })({ disabled: false }); Output: "btn interactive".
Implement the exported class-name generator in index.js or index.ts. Tests provide fixtures for the required behavior.