Skip to main content

Component <Popper />

Props

PropsTypeMeaningPossible values
colorstringChange popper background colorwhite / dark
positionstringChange popper position around the elemettop-left / top / top-right / right-top / right / right-bottom / bottom-left / bottom / bottom-right / left-top / left / left-bottom
isOpenbooleanSet popper statustrue / false



Colors

const PopperColor = ({ color }) => {
const [isPopper, setPopper] = useState(false)

return (
<>
<button type="button" onClick={event => setPopper(isPopper ? false : event.currentTarget)}>
Open {color.replace('-', ' ')}
</button>

<Popper isOpen={isPopper} color={color}>
Some useful info
</Popper>
</>
)
}



Positions

const PopperPos = ({ position }) => {
const [isPopper, setPopper] = useState(false)

return (
<>
<button type="button" onClick={event => setPopper(isPopper ? false : event.currentTarget)}>
Open {position.replace('-', ' ')}
</button>

<Popper isOpen={isPopper} position={position}>
Some useful info
</Popper>
</>
)
}