react-tooltip-portal
Small, unopinionated react tooltip library built using react 16's portal API.
Install
$ npm install react-tooltip-portal --save
Usage
state = tipActive: false { return <div className="App"> <img src=logo ref= thistipRef = c onMouseEnter= this onMouseLeave= this /> <Tooltip active=thisstatetipActive parent=thistipRef position='left' tipStyle=color: 'red' > <div>Im a tool tip!</div> </Tooltip> </div> }
Props
active
: boolean, the tooltip will be visible if trueclassName
: string, CSS class to apply to the tooltipoffset
: number, how far the tooltip gets placed from the parentparent
: the tooltip will be placed next to this element, must be a React refposition
: top, right, bottom or left. Default to left.timeout
: amount of time to allow for user to hover over tooltip (will stay open if hovering regardless of props.active)tipStyle
: object, override any of the tool tips default styles
MIT © Jack Hanford