UNPKG

react-srcdoc-iframe

Version:

String HTML parse into iframe and supported IE6.This is polyfill of srcDoc.

78 lines (48 loc) 1.26 kB
# React-srcDoc-iframe ![Build Status](https://travis-ci.org/joemccann/dillinger.svg?branch=master) This is the polyfill of iframe srcDoc for react and supported upto IE-6. - Simple and light weight(<4KB). - Used both for src and srcDoc. - Easy to use. ### Installation Install the dependencies. ```sh $ npm i react-srcdoc-iframe ``` ### Example ```js import React from 'react'; import ReactSrcDocIframe from 'react-srcdoc-iframe'; const html = ` <!DOCTYPE html> <html> <head> <title>Hello Page</title> </head> <body> <p>Hello this is string html</p> </body> </html> `; const App = () => { return <ReactSrcDocIframe srcDoc={html} width="500" height="500" />; }; ``` ### Props | Plugin | README | | ------ | ------ | | src | string (url to render inside html) | | srcDoc | string (html string to render inside iframe) | | id | string (unique id for iframe) | | style | object ( {{border:"10px"}} ) | | onLoad | funtion (after load iframe this will be called) | | title | string ("title for iframe") | | frameBorder | string ("0") | | height | string ("200px") | | width | string ("100px") | | referrerPolicy | string | | sandbox | string | License ---- MIT **Free Software, Hell Yeah!**