Stroke Width not working on SVG with React #3286
-
|
I'm running a react app with Tailwind and using HeroIcons, trying to apply I have to edit the strokeWidth manually at Any idea if this is supposed to happen? I tried reproducing the bug, but I dont know any code playground online that supports both React and Tailwind. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
|
Hey! Chances are that you are applying If you add |
Beta Was this translation helpful? Give feedback.
-
|
This is not working for me |
Beta Was this translation helpful? Give feedback.
-
|
The solution mentioned above applies to the entire svg being copied into the react component and adding import { IconComponent } from '@heroicons/react/outline'A better solution is warranted imho. |
Beta Was this translation helpful? Give feedback.


Hey!
Chances are that you are applying
stroke-1to thesvgelement, but thestrokeWidthattribute is overriding this because it's declared on thepathelement itself.If you add
className="stroke-1"to thepathwhich has thestrokeWidthattribute, it should works (I just tried on a NextJS project with theacademic-capheroicon, and it worked 👍