1.0.4 • Published 3 years ago
react-material-popover v1.0.4
react-material-popover
A simple material-ui popover using ref instead of state
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