Skip to content

cyan33/reactip

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reactip

tooltip component for react.

Examples

visist https://huozhi.github.io/reactip

Usage

npm i --save reactip

Wrapp the trigger with Tooltip component

import React from 'react'
import Tooltip from 'reactip'

const Button = ({children, ...rest}) => (
  <button {...rest}>{children}</button>
)

const Demo = () => (
  <div>
    <Tooltip placement="right" tooltip="something" event="hover">
      <Button className="Button">right</Button>
    </Tooltip>

    <Tooltip placement="top" tooltip="something" event="click">
      <button className="Button">top</button>
    </Tooltip>
  <div>
)

API

props type default description
placement string x placement tooltip showup: [top, right, bottom, left]
tooltip anything null tooltip content, you can pass DOM node or react component
event string hover trigger event: [hover, click]
offsetParent node document.body position will be calculated relative to this node
popupStyle object undefined popup style object

License

Reactip is released under the MIT license.

About

ℹ️ auto repositioning tooltip component for react

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%