Skip to content

brunocarvalhodearaujo/react-sandbox-frame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Sandbox Frame

npm version License Dependency Status devDependency Status npm

this package create an customizable and declarative iframe

usage

import React, { Component } from 'react'
import Frame from 'react-sandbox-frame'

export class WebView extends Component {

  /**
   * connect frame and you component
   * @param {HTMLElement} document
   */
  onLoad (document) {
    console.log(document) // output <p>hello world</p>
  }

  render () {
    return (
      <Frame onLoad={this.onLoad.bind(this)}>
        <p>hello world</p>
      </Frame>
    )
  }

}

Optional Props

The Frame component takes a couple of props that you can use to customize its behaviour:

  • children [?element]
  • onLoad [?function]
  • src [?string]
  • style [?object]
  • title [?string=page-wrapper]
  • stylesheets [?Array<String>=[]]
  • scripts [?Array<String>=[]]