React with CSS Modules
This content is for Beta. Switch to the latest version for up-to-date documentation.
This example builds a button component with cva, styled with CSS Modules, in a React project. The button gallery in src/app.tsx reads the component schema with getSchema, so new variant values appear without updating a second list.
This example declares defaultVariants on the class function, so getSchema exposes each variant’s defaultValue. See Default variants for when to use class-function defaults or framework prop defaults.