-
Say I'm using cva for a button. Each button has variants: outline, subtle, ghost, link. But then there are colors too. Theoretically you'd need the different variants for each color, or each color for each variant. I know there are compound variants. Does cva support nested variants? If not, what is the best way to use the compoundVariants key? Are there examples for a button or something? Or is it recommended to create multiple cva and put them into an object with colors as the keys of those objects?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Any idea on nested variants anyone? |
Beta Was this translation helpful? Give feedback.
-
@paulwongx did you get a solution? I am also trying to make this work export const btnColors = {
primary: {
solid: "bg-primary text-white ",
raised:
"hover:[box-shadow:rgba(123,_107,_214,_0.42)_0px_14px_26px_-12px,_rgba(0,_0,_0,_0.12)_0px_4px_23px_0px,_rgba(123,_107,_214,_0.2)_0px_8px_10px_-5px]",
outlined:
"border border-primary text-primary hover:bg-primary hover:text-white",
},
secondary: {
solid: "bg-secondary text-white ",
raised:
"hover:[box-shadow:rgba(123,_107,_214,_0.42)_0px_14px_26px_-12px,_rgba(0,_0,_0,_0.12)_0px_4px_23px_0px,_rgba(123,_107,_214,_0.2)_0px_8px_10px_-5px]",
outlined:
"border border-secondary text-secondary hover:bg-secondary hover:text-white",
},
DEFAULT: {
solid:
"bg-white hover:border-[#b5b5b5] dark:hover:border-[#b5b5b5] dark:hover:text-[#323234] border border-fade-grey-2 dark:border-night-light-14 text-dark dark:text-smoke-white dark:bg-night-light-6",
raised: "",
outlined: "",
},
};
` |
Beta Was this translation helpful? Give feedback.
@vfshera ^This was what I ended up with. Multiple cvas.