# react-tooltip-portal

> Small unopinionated react tooltip library built using react 16's portal API.

Latest version **0.5.2** (published 2019-05-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-tooltip-portal
pnpm add react-tooltip-portal
yarn add react-tooltip-portal
bun add react-tooltip-portal
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.2 |
| Published | 2019-05-20 |
| First published | 2017-10-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 9.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Maintainers | hanford |
| Keywords | react, document.body, overflow, hidden, block, touchmove, scroll |

## Links

- npm: https://www.npmjs.com/package/react-tooltip-portal
- Repository: https://github.com/hanford/react-tooltip-portal
- Issues: https://github.com/hanford/react-tooltip-portal/issues
- npm.io page: https://npm.io/package/react-tooltip-portal

## Dependencies (2)

- [global](https://npm.io/package/global.md) ~4.3.2
- [prop-types](https://npm.io/package/prop-types.md) ~15.6.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.5.2 (latest) — 2019-05-20
- 0.5.1 — 2019-05-20
- 0.5.0 — 2019-05-16
- 0.4.0 — 2018-04-02
- 0.3.0 — 2017-10-03
- 0.2.0 — 2017-10-03
- 0.1.1 — 2017-10-02
- 0.1.0 — 2017-10-02

## README

## react-tooltip-portal

Small, unopinionated react tooltip library built using react 16's portal API.

## Install

```
$ npm install react-tooltip-portal --save
```

## Usage

```js
import Tooltip from 'react-tooltip-portal'

class App extends Component {
  state = {
    tipActive: false
  }

  render () {
    return (
      <div className="App">
        <img
          src={logo}
          ref={c => this.tipRef = c}
          onMouseEnter={() => this.setState({ tipActive: true })}
          onMouseLeave={() => this.setState({ tipActive: false })}
        />

        <Tooltip
          active={this.state.tipActive}
          parent={this.tipRef}
          position='left'
          tipStyle={{color: 'red'}}
        >
          <div>Im a tool tip!</div>
        </Tooltip>
      </div>
    )
  }
}
```

### Props

* `active`: boolean, the tooltip will be visible if true
* `className`: string, CSS class to apply to the tooltip
* `offset`: number, how far the tooltip gets placed from the parent 
* `parent`: the tooltip will be placed next to this element, must be a React ref
* `position`: 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](http://jackhanford.com)

---
_Source: https://npm.io/package/react-tooltip-portal · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
