npm.io
1.0.4 • Published 5 years ago

react-material-popover

Licence
MIT
Version
1.0.4
Deps
2
Size
12 kB
Vulns
0
Weekly
0

react-material-popover

A simple material-ui popover using ref instead of state

NPM JavaScript Style Guide

Install

npm install --save react-material-popover
yarn add react-material-popover

Usage

import React, { useRef } from 'react'
import MaterialPopover from 'react-material-popover'

const Content = ({ closePopover }) => {
  return (
    <button onClick={closePopover} style={{ padding: '2rem' }}>
      Close
    </button>
  )
}
const App = () => {
  const ref = useRef(null)
  return (
    <>
      <button ref={ref}>test</button>
      <MaterialPopover
        ref={ref}
        paper={{ borderRadius: '5px' }}
        anchorOrigin={{
          vertical: 'bottom',
          horizontal: 'left'
        }}
        transformOrigin={{
          vertical: 'top',
          horizontal: 'left'
        }}
      >
        <Content></Content>
      </MaterialPopover>
    </>
  )
}

License

MIT InterviewCandies