Skip to content

alecmekarzel/react-popover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Popover

Examples

Tooltips

import { Tooltip } from 'react-popover'

let Component = () => {
	return (
		<Tooltip content="I am a tooltip">
			<button>I have a tooltip</button>
		</Tooltip>
	)
}

Popovers

import { Popover } from 'react-popover'

let Component = () => {
	return (
		<Popover
			popover={({ visible, open, close }) => {
				return (
					<div>
						I am a popover and i am{' '}
						{visible ? 'visible' : 'not visible'} and{' '}
						{open ? 'open' : 'not open'}
						<button onClick={() => close()}>Close me</button>
					</div>
				)
			}}
		>
			<button>I have a popover</button>
		</Popover>
	)
}

The popover prop gets passed an object with three values (open, visible and close) and must return a ReactElement.

The open value is true when the popover is fully visible or animating.

The visible value is true when the popover is fully visible.

The close value is a function, which you can call to close the popover.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published