1.0.0 • Published 5 years ago

react-handheld-portal-device v1.0.0

Weekly downloads
791
License
MIT
Repository
github
Last release
5 years ago

React Handheld Portal Device 🌀

npm Build Status code style: prettier Netlify Status Greenkeeper badge

Makes positioning portaled tooltips/dropdowns/etc a piece of cake 🍰!

Demo

Usage

import React from 'react';
import Portal from 'react-handheld-portal-device';

const Component = () => (
  <Parent>
    <Portal>
      (parentRect => <Content style={{ position: 'fixed', top: parentRect.top, left: parentRect.left,  }} />)
    </Portal>
  </Parent>
);

Using the render props pattern the Content can be "aware" of Parent's parentRect, which is the result of calling getBoundingClientRect on the Parent DOM node.

Props

class Portal extends React.Component {
  static propTypes = {
    debounce: PropTypes.number, // set the debounce time for event listeners
  };

  static defaultProps = {
    debounce: 16,
  };

  ...
}
1.0.0

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.12

5 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago