Totally controlled popover component.
  • JavaScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
İsmail Demirbilek 4ef170d719
Merge pull request #8 from nandukalidindi/master
Use React 16.0 to support all updated applications
2017-11-19 12:40:16 +03:00
lib corrects typo on "styleStyle" 2017-09-27 00:11:53 -04:00
src use simple quotes 2017-10-10 20:20:01 -04:00
.babelrc initial commit 2016-07-26 00:06:17 +03:00
.gitignore log removed 2016-07-26 00:45:16 +03:00
.npmignore updated npmignore 2017-04-24 17:36:27 +03:00
demo.gif added gif 📷 2017-04-24 17:56:11 +03:00
LICENSE license added 2016-07-26 00:38:23 +03:00
package.json Use React 16.0 to support all updated applications 2017-11-16 11:33:48 -05:00
README.md adds missing props to readme 2017-09-27 00:12:34 -04:00

React Simple Popover

Totally controlled popover component based on React Overlays.

Demo

Try yourself

Install

 $ npm install react-simple-popover

Usage

import Popover from 'react-simple-popover';
import React, { Component } from 'react';

class PopoverDemo extends Component {
  constructor(props) {
    super(props);
    this.state = {
      open: false
    };
  }

  handleClick(e) {
    this.setState({open: !this.state.open});
  }

  handleClose(e) {
    this.setState({open: false});
  }

  render() {
    return (
      <div>
        <a
          href="#"
          className="button"
          ref="target"
          onClick={this.handleClick.bind(this)}>Popover</a>
        <Popover
          placement='left'
          container={this}
          target={this.refs.target}
          show={this.state.open}
          onHide={this.handleClose.bind(this)} >
          <p>This is popover</p>
        </Popover>
      </div>
    );
  }
}

Options

placement
One of left, right, bottom or top.

show
Boolean, true if popover is shown; false otherwise.

onHide
Hide callback function.

target
Target ref to align popover around target element.

container
Reference to the component that represents the context

hideWithOutsideClick
Boolean, true if popover should hide when clicked outside; false otherwise.

containerStyle
Style for outermost container

style
Style for the content's container

Author

Ismail Demirbilek - @dbtek
MIT Licensed