xux-portal

    1.0.1 • Public • Published

    xux-portal

    COMPONENT DESCRIPTION GOES HERE

    Demo & Examples

    Live demo: keesee.github.io/xux-portal

    To build the examples locally, run:

    npm install
    npm start
    

    Then open localhost:8000 in a browser.

    Installation

    The easiest way to use xux-portal is to install it from NPM and include it in your own React build process (using Browserify, Webpack, etc).

    You can also use the standalone build by including dist/xux-portal.js in your page. If you use this, make sure you have already included React, and it is available as a global variable.

    npm install xux-portal --save
    

    Usage

    Simple include and use the Portal component. children are rendered in the opened portal. the anchor prop serves as the launcher. Close on esc and outside click are of cource provided. A few other useful true/false props are provided. Close on Scroll (closeOnScroll), close on resize(closeOnResize), and hijacking the mouse wheel (noScroll) for a quick way to disable scrolling via the mouse wheel for browsers/devices that support it. if you set the measure prop to true this portal component will send the bounding box properties of the anchor to the portal as the position object. this is useful if you need to know where where on the page the portal was launched. I use this feature for creating overlays and animations like popups and affixed floats.

    var Portal = require('xux-portal');
    
    <Portal
    closeOnResize
    closeOnScroll
    closeOnClick
    escClose
    measure
    noscroll
    anchor={<button>Another portal</button>}
    anchorprops={{}}>>
      <span>Content of the portal<span>
    </Portal>
    

    Development (src, lib and the build process)

    NOTE: The source code for the component is in src. A transpiled CommonJS version (generated with Babel) is available in lib for use with node.js, browserify and webpack. A UMD bundle is also built to dist, which can be included without the need for any build system.

    To build, watch and serve the examples (which will also watch the component source), run npm start. If you just want to watch changes to src and rebuild lib, run npm run watch (this is useful if you are working with npm link).

    Copyright (c) 2017 Jimmy Keesee.

    Keywords

    none

    Install

    npm i xux-portal

    DownloadsWeekly Downloads

    3

    Version

    1.0.1

    License

    none

    Last publish

    Collaborators

    • jimmykeesee