icons icon indicating copy to clipboard operation
icons copied to clipboard

SVG sprite to avoid DOM bloat, is it a possibility?

Open AdsonCicilioti opened this issue 2 years ago • 0 comments

One thing I really admire about Radix's Primitive Components is the fact that it doesn't bloat the DOM with multiple portal instances. Mounting the element only when it is required.

A similar thing in SVG icons, would be the implementation of Sprites - A single SVG Element containing several encapsulated Symbol icons, which can be used in different parts of the DOM. Imagine a list of any articles or entries. 50 items containing 3 or 4 icons in each...

image

Repeatedly, many insertions of the same code.

I believe that the SVG Sprite approach can be very interesting in these cases. I don't know about the negative impacts this approach might have. I can only see the benefit of a more streamlined and cleaner gift.

AdsonCicilioti avatar Mar 15 '22 14:03 AdsonCicilioti