react-travel
Simple, unopinionated, React portal that renders it's subtree into a desired container.
Last updated 8 years ago by souporserious .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install react-travel 
SYNC missed versions from official npm registry.

React Travel

npm version Dependency Status

Your subtree should be able to travel into another top-level tree.

Example

<Travel
  onMount={node => {
    return(
      $(node).dialog({
        autoOpen: false,
        close: () => {
          this.setState({dialogOpen: false})
        }
      }).data('ui-dialog')
    )
  }}
  onUpdate={dialog => {
    if(dialogOpen) {
      dialog.open()
    } else {
      dialog.close()
    }
  }}
>
  <div>
    Even works with third party dialogs!
  </div>
</Travel>

Props

to: PropTypes.any

What node the portal is rendered to, defaults to document.body.

tag: PropTypes.string

What tag to use for the portal, defaults to div.

id: PropTypes.string

React id prop.

className: PropTypes.any

React className prop.

style: PropTypes.object

React style prop. Accepts an object of styles that are applied to the portal. Note that values require their respective unit applied i.e style={{padding: '12px'}}.

children: PropTypes.element

Accepts a single React element or component.

onMount: PropTypes.func

onUpdate: PropTypes.func

onUnmount: PropTypes.func

All tie into React's life cycle methods. Returns portal node with any work done to it.

Current Tags

  • 1.3.6                                ...           latest (6 years ago)

14 Versions

  • 1.3.6                                ...           6 years ago
  • 1.3.5                                ...           7 years ago
  • 1.3.4                                ...           7 years ago
  • 1.3.3                                ...           7 years ago
  • 1.3.2                                ...           7 years ago
  • 1.3.1                                ...           8 years ago
  • 1.3.0                                ...           8 years ago
  • 1.2.1                                ...           8 years ago
  • 1.2.0                                ...           8 years ago
  • 1.1.2                                ...           9 years ago
  • 1.1.1                                ...           9 years ago
  • 1.1.0                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
  • 0.0.1                                ...           9 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (21)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE