Possible to inject material UI styles into iframe?

Viewed 315

I'm using material UI 4.9.x and it doesn't seem possible to use MUI in an iframe with the global styles.

I'm trying to use a React portal to inject the content into the iframe.

THAT part works and my MUI context menu works properly, just has the wrong styles.

I'm trying to inject the styles via CssBaseline but that gets injected into the host window not the iframe window.

I've verified this by looking at the DOM and I can see the elements created there under and not in the iframe.

How would I go about injecting this, completely, into the iframe window.

One idea I had was to change the current / global document and window objects to represent the iframe but worried that might be too hacky.

0 Answers
Related