ant-design / ant-design-icons

⭐ Ant Design SVG Icons
https://ant.design/components/icon/
MIT License
940 stars 577 forks source link

Add `attachTo` to IconContext? #522

Open jacobweberbowery opened 2 years ago

jacobweberbowery commented 2 years ago

Would it be possible to add an optional attachTo property to IconContext, that gets passed through to updateCSS when you call useInsertStyles? The updateCSS function already supports this.

The use case is that I'd like to include an icon within a Web Component's shadow DOM. I want the style sheet to be inserted inside the shadow DOM, instead of the document head, so it only affects the component.

So it would ideally support ShadowRoot elements as well as other Element types.

noru commented 1 year ago

+1

noru commented 1 year ago

willing to accept a PR?

noru commented 1 year ago

related: https://github.com/ant-design/ant-design/issues/38911

Psvensso commented 1 year ago

@noru Did you find a workaround other than manually copy/past the styles inside the shadow?