Tailwind stroke-width classes are ignored due to the hardcoded path attribute
See original GitHub issueI’ve started using the outline icons in a new project, with Tailwind CSS. I’ve run into a problem since Tailwind’s stroke-width stroke-1
etc. classes don’t work, because each <path>
has a hard-coded stroke-width="2"
attribute that overrides the inherited class style.
Could stroke-width="2"
be placed on the <svg>
element instead? According to the spec this is still inherited (so defaults work), but a class style takes precedence because of specificity. My own quick tests on latest Chrome, Safari, and Firefox confirm this.
I’m using the SVG code directly (inlining in HTML), though it seems like this would be an issue for all the methods. I can fix this manually on each icon, but it’s a pain…
Issue Analytics
- State:
- Created 2 years ago
- Reactions:24
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Content Configuration - Tailwind CSS
Configuring source paths. Tailwind CSS works by scanning all of your HTML, JavaScript components, and any other template files for class names, ...
Read more >Tailwind CSS classes is not working in my project?
This error is due to tailwind not finding any classes to scan in what it 'thinks' is your HTML code directories.
Read more >♀️ ♂️ Tailwind CSS with Heroicons: The SVG path stoke ...
Yes, Tailwind CSS has a class stroke-{number} that allows you to customize this attribute only for the element that has it. But in...
Read more >Why I Don't Like Tailwind CSS | Aleksandr Hovhannisyan
With that out of the way, let's look at some of the reasons why I don't ... Because Tailwind classes are atomic building...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Hashnode Post
No results found
Heads up to anyone watching this, my PR resolving this is now available at #281. Tests and (if necessary) corrections are welcome!
@Kerosz I haven’t had time to do this yet, and I still haven’t seen anything from the actual heroicons maintainers about it… Nonetheless, I now need this urgently myself at work, so you can expect a fork & PR in the next few days.