GithubHelp home page GithubHelp logo

igor-lemon / react-popover Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dbtek/react-popover

0.0 2.0 0.0 537 KB

Totally controlled popover component.

License: MIT License

HTML 2.21% JavaScript 94.89% CSS 2.89%

react-popover's Introduction

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={(node) => { this.target = node }}
          onClick={this.handleClick}>Popover</a>
        <Popover
          placement='left'
          container={this}
          target={this.target}
          show={this.state.open}
          onHide={this.handleClose} >
          <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

react-popover's People

Contributors

dbtek avatar diegomichell avatar nandukalidindi avatar shoaibbhimani avatar vamosgs avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.