ryanseddon / react-frame-component

Render your React app to an iFrame
http://ryanseddon.github.io/react-frame-component/
MIT License
1.75k stars 156 forks source link

how to use external css file inside the iframe #254

Closed sheikharifulislam closed 7 months ago

sheikharifulislam commented 7 months ago

i have used react-frame-component for manage Iframe. but problem is when i want to use an external CSS file inside the Iframe. then this CSS style does not load in the iframe. how to solve this problem ?

ryanseddon commented 7 months ago

Depends on how you want to add the css if it's just a url to a css file you can add a <link> tag to the head prop.

<Frame style={styles} head={<link href="styles.css" rel="stylesheet" />}>

Or it can be part of the initialContent https://github.com/ryanseddon/react-frame-component/blob/1b44f0a98a7b02710f7de6c6b0ed81cc524fc545/example/app.jsx#L49-L53

You can also use <style> tags there too

https://github.com/ryanseddon/react-frame-component/blob/1b44f0a98a7b02710f7de6c6b0ed81cc524fc545/example/app.jsx#L34

There is an open issue to fix this missing documentation #242