Why don't we write all cva
variant rules as compound styles?
#1404
Replies: 2 comments
-
Hi @jorgezreik, That's an interesting thought. Technically speaking, Panda doesn't impose any recommended way of writing cvas. You can use both variants and compound variants. Regarding your suggested syntax, I think this is a bug in our code. Compound variants should only allow you to select from already defined variants. This will be updated pretty soon. You also lose type safety for the second syntax since you're selecting variants that were not defined. |
Beta Was this translation helpful? Give feedback.
-
@jorgezreik I also find compound variants useful and more expressive as well as more customized. |
Beta Was this translation helpful? Give feedback.
-
The
cva
function lets us write simple variants and compound variants. If compound variants are a more expressive way to write multi-variant styles, why use simple variants at all?Not a suggestion, just trying to understand the design decisions behind the syntax!
Example
With simple and compound variants you would write a style like this:
With just compound variants, we could write this:
Why is the first preferred?
Beta Was this translation helpful? Give feedback.
All reactions