tappleby / react-sandbox-frame

react customizable and declarative iframe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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>=[]]

About

react customizable and declarative iframe


Languages

Language:JavaScript 100.0%