Closed Hamza-Liaqat1 closed 9 months ago
For example, the text-white and text-primary classes should not be applied at the same time if they conflict.
I think maybe there's a misunderstanding here, cva
doesn't handle class conflicts for Tailwind.
For that you'll need to implement tw-merge
:
https://cva.style/docs/getting-started/installation#handling-style-conflicts
Thank you so much, It works.
Describe the bug In a Next.js (version 13.5.4) project with
class-variance-authority
(version ^0.7.0), I observe that class names are being duplicated on the generated elements, specifically when using compound variants. This results in conflicting styles being applied to the components, causing them to not render with the expected styles.To Reproduce Steps to reproduce the behavior:
class-variance-authority
(version ^0.7.0).cva
and set up multiple variants and compound variants.For example, in a
Button
component:The generated class names include conflicting styles, e.g.:
Note the duplication of text-white and text-primary.
Expected behavior The class names generated for the component should be non-conflicting and should represent the correct combination of the specified variants. For example, the text-white and text-primary classes should not be applied at the same time if they conflict.
Desktop:
Additional context This issue results in unexpected visual rendering of the components due to the conflicting styles from the duplicated class names. It happens when rendering components with specific combinations of variants, particularly with compound variants.