npm

npm install --save react-element-popper

yarn

yarn add react-element-popper

Basic Import

In the most cases, just importing ElementPoper is enough.

import ElementPopper from "react-element-popper"

If you want to enable built-in arrow or popper shadow, you need to import the style as well:

import "react-element-popper/build/element_popper.css"

Usage

import React from "react"
import ElementPopper from "react-element-popper"

export default function Example() {
  const Div = ({ children }) => (
    <div
      style={{
        border: "1px solid black",
        backgroundColor: "white"
      }}
    >
      { children}
    </div>
  )

  return (
    <ElementPopper
      element={<Div>Refrence Element</Div>}
      popper={<Div>Popper Element</Div>}
    />
  )
}