cva is really just a fancy way of managing a string. This makes it useful in a variety of contexts beyond UI component libraries.
BEM
BEM
CVA maps naturally onto BEM (Block Element Modifier) naming conventions. Define your base block class and use modifier classes as variant values.
styles.css
button.ts
11ty (Eleventy)
11ty (Eleventy)
Use CVA in 11ty JavaScript templates to generate class strings server-side. Since 11ty runs in Node.js, use
require to import CVA.button.11ty.js
Dynamic text content
Dynamic text content
cva isn’t limited to class names — since it returns a plain string, you can use it to manage any variant-driven text output.