1.12.0 • Published 4 years ago

react-tooltip-lite v1.12.0

Weekly downloads
19,266
License
MIT
Repository
github
Last release
4 years ago

React tooltip-lite

A lightweight and responsive tooltip. Feel free to Post an issue if you're looking to support more use cases.

Getting started

1. Install with NPM

$ npm install react-tooltip-lite

2. Import into your react Component

import Tooltip from 'react-tooltip-lite';

3. Wrap any element with the Tooltip component to make it a target

<Tooltip content="Go to google">
    <a href="http://google.com"> edge</a>
</Tooltip>

CodePen demo: http://codepen.io/bsidelinger912/pen/WOdPNK

styling

By default you need to style react-tooltip-lite with CSS, this allows for psuedo elements and some cool border tricks, as well as using css/sass/less variables and such to keep your colors consistent. (Note: as of version 1.2.0 you can also pass the "useDefaultStyles" prop which will allow you to use react-tooltip-lite without a stylesheet.)

Since the tooltip's arrow is created using the css border rule (https://css-tricks.com/snippets/css/css-triangle/), you'll want to specify the border-color for the arrow to set it's color.

Here's an example stylesheet:

.react-tooltip-lite {
  background: #333;
  color: white;
}

.react-tooltip-lite-arrow {
  border-color: #333;
}

For more examples, see the CodePen demo: http://codepen.io/bsidelinger912/pen/WOdPNK.

Props

You can pass in props to define tip direction, styling, etc. Content is the only required prop.

Here's an example using more of the props:

<Tooltip
  content={(
      <div>
          <h4 className="tip-heading">An unordered list to demo some html content</h4>
          <ul className="tip-list">
              <li>One</li>
              <li>Two</li>
              <li>Three</li>
              <li>Four</li>
              <li>Five</li>
          </ul>
      </div>
  )}
  direction="right"
  tagName="span"
  className="target"
>
    Target content for big html tip
</Tooltip>

To see more usage examples, take look at the /example folder in the source.

1.12.0

4 years ago

1.11.2

4 years ago

1.11.1

4 years ago

1.11.0

4 years ago

1.10.0

5 years ago

1.9.5

5 years ago

1.9.4

5 years ago

1.9.3

5 years ago

1.9.2

5 years ago

1.9.1

5 years ago

1.9.0

5 years ago

1.8.0

5 years ago

1.7.1

6 years ago

1.7.0

6 years ago

1.6.1

6 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago