Closed JustScriptin closed 1 month ago
this might be a tailwind-merge issue but I'm not entirely sure.
I think it is in this case! I don't see why cva
would be stripping your default classes away here; it's just joining them together
I'd reach out over there 🙏
Describe the bug The
stroke-current
class from Tailwind CSS is not being applied correctly when used within thecva
function from theclass-variance-authority
library. Despite being included in the base styles ofcva
, thestroke-current
class does not appear in the final class string.To Reproduce Steps to reproduce the behavior:
cva
function to define class variants.stroke-current
class in the base styles of thecva
function (first argument to the cva function).stroke-current
class is missing from the final class string.note: notice the order in my code snippet below. you will not be able to replicate the issue if you change the order. because putting
stroke-current
at the end fixes the issueExpected behavior The
stroke-current
class should be included in the final class string generated by thecva
function, allowing the SVG stroke color to inherit the current text color.Desktop:
Additional context Here is the relevant configuration and code:
package.json:
Component Code:
Usage Example:
Observed Behavior: The final class string output in the console:
stroke-current
is not present in the output.Expected Behavior: The final class string should include
stroke-current
:Additional Information:
stroke="currentColor"
is directly set as an attribute on the SVG element.stroke-current
in theclassName
prop directly works as expected:Please help investigate why
stroke-current
is not being included in the final class string when using thecva
function, and provide a solution.workarounds for this issue:
stroke="currentColor"
attribute directly on the svg<RocketIcon className="stroke-current text-foreground dark:text-accent-foreground" />
stroke-current
tailwindcss class to the end of cva's first argumentThank you! ps. this might be a tailwind-merge issue but I'm not entirely sure.