This content originally appeared on flaviocopes.com and was authored by flaviocopes.com
I was using Heroicons in a Next.js app and they conveniently package the icons as React components.
One thing I wanted to do was customize the stroke width, so they rendered thinner.
I looked how to do that within the JSX, maybe with a prop, but I couldn’t find a way.
I could import the SVG directly from the site, but I liked the React components approach.
For some reason I assumed setting a global CSS property directly didn’t work, as it was hardcoded in the SVG, but it actually worked:
svg path {
stroke-width: 1;
}
This content originally appeared on flaviocopes.com and was authored by flaviocopes.com
flaviocopes.com | Sciencx (2021-07-11T05:00:00+00:00) Change the Heroicons SVG stroke width in React. Retrieved from https://www.scien.cx/2021/07/11/change-the-heroicons-svg-stroke-width-in-react/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.