Closed jouni closed 1 year ago
If you want to use such stoke icons today, you will have to convert those strokes to filled paths using an SVG editor (e.g. “outline strokes”), and then export the SVG code again.
The logic was changed in #4164 so that the original SVG element is fully cloned, only the id
attribute is removed.
So this should no longer be an issue with the latest Vaadin 23.1 (as the fix was also backported to that version).
Oh, right, so it is possible to just put a bunch of <svg>
elements inside the <defs>
element, without the <g>
element. Great, that does solve all the issues I had. Thanks!
Actually, need to wrap the original <svg>
inside a <g id="...">
element. Then it works.
Describe your motivation
Many 3rd party icon sets use
stroke="currentColor"
andstroke-width="2"
when defining icon paths/shapes, instead of solid paths that usefill="currentColor"
.Currently it’s not easy to use such icons together with
<vaadin-icon>
, because it assumes all paths are filled.Describe the solution you'd like
Respect the
fill
,stroke
, andstroke-width
attributes defined on the<g>
elements in the<vaadin-iconset>
definitions.For example, if I have the following iconset defined:
When I use that icon with
<vaadin-icon icon="myapp-outline:academic-cap">
, the<svg>
element that gets inserted to the DOM should include the attributes:<svg fill="none" stroke-width="2" stroke="currentColor">
Describe alternatives you've considered
Allow defining the same attributes on the
<vaadin-iconset fill="none" stroke="currentColor" stroke-width="2">
element and copy those over to the<svg>
elements.That would be a bit more limiting, as it assumes all icons in the set want the same strokes and that they are not filled.
Perhaps both could be used, and that attributes on the
<g>
elements would override the ones on the<vaadin-iconset>
element.Additional context
An icon set that uses strokes instead of filled paths: https://github.com/tailwindlabs/heroicons/tree/master/optimized/outline