Why are TailwindCSS styles not applied when using cn function in my Select component? #1854
Replies: 1 comment 1 reply
-
Did you find an answer? I'm getting the same issue |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am working on a React project using Next.js and TailwindCSS. I have a custom Select component where I am trying to dynamically apply TailwindCSS classes using a cn function. The className does get applied to the HTML element, but the styles are not reflected.
screenshot
Demo
You can find a demonstration of the issue on this CodeSandbox.
Here is a simplified version of my Select component:
And here is my cn function:
The issue is that while the className like "h-4 w-4 rounded-full bg-gradient-to-br from-green-300 via-blue-500 to-purple-600" does get applied to the div, the gradient background doesn't show up.
Things I've tried:
Clearing cache
Checking for specificity issues
Making sure TailwindCSS is correctly configured and imported
Any help would be appreciated. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions