Skip to content

Commit f579913

Browse files
Merge branch 'master' into tooltip-effect-float
2 parents e8058a6 + bfb1bf6 commit f579913

File tree

5 files changed

+32
-18
lines changed

5 files changed

+32
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ or if you want to still use the name ReactTooltip as V4:
5151
import { Tooltip as ReactTooltip } from 'react-tooltip'
5252
```
5353

54-
2 . Add data-tooltip-content = "your placeholder" to your element
54+
2 . Add `data-tooltip-content="your placeholder"` to your element
5555

5656
```jsx
5757
<p id="my-element" data-tooltip-content="hello world">

docs/docs/getting-started.mdx

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,49 +56,62 @@ There are two ways to use ReactTooltip.
5656

5757
### ReactTooltip props
5858

59-
1 . Require react-tooltip after installation
59+
1 . Import `react-tooltip` after installation
6060

6161
```js
62-
import ReactTooltip from 'react-tooltip'
62+
import { Tooltip } from 'react-tooltip'
6363
```
6464

65-
2 . Add data-content = "your placeholder" to your element
65+
2 . Create anchor element
6666

6767
```jsx
6868
<p id="my-anchor-element">Tooltip</p>
6969
```
7070

71-
3 . Include react-tooltip component
71+
3 . Create `<Tooltip />` element
7272

7373
```jsx
74-
<ReactTooltip anchorId="my-anchor-element" content="hello world" place="top" />
74+
<Tooltip anchorId="my-anchor-element" content="hello world" place="top" />
7575
```
7676

7777
### Anchor data attributes
7878

79-
1 . Require react-tooltip after installation
79+
1 . Import `react-tooltip` after installation
8080

8181
```js
82-
import ReactTooltip from 'react-tooltip'
82+
import { Tooltip } from 'react-tooltip'
8383
```
8484

85-
2 . Add data-content = "your placeholder" to your element
85+
2 . Add `data-tooltip-content="your placeholder"` to your element
8686

8787
```jsx
8888
<p id="my-anchor-element" data-tooltip-content="hello world" data-tooltip-place="top">
8989
Tooltip
9090
</p>
9191
```
9292

93+
3 . Create `<Tooltip />` element
94+
95+
```jsx
96+
<Tooltip anchorId="my-anchor-element" />
97+
```
98+
9399
### Styling
94100

95-
If you want a styled tooltip, don't forget to add the style file `import 'react-tooltip/dist/react-tooltip.css`
101+
If you want a styled tooltip, don't forget to add the style file `import 'react-tooltip/dist/react-tooltip.css`.
96102

97-
3 . Include react-tooltip component
103+
Basic styling can be done by overriding the following css variables.
98104

99-
```jsx
100-
<ReactTooltip anchorId="my-anchor-element" />
105+
```css
106+
:root {
107+
--rt-color-white: #fff;
108+
--rt-color-dark: #222;
109+
--rt-color-success: #8dc572;
110+
--rt-color-error: #be6464;
111+
--rt-color-warning: #f0ad4e;
112+
--rt-color-info: #337ab7;
113+
--rt-opacity: 0.9;
114+
}
101115
```
102116

103-
<TooltipAnchor id="props-basic">◕‿‿◕</TooltipAnchor>
104-
<Tooltip anchorId="props-basic" content="hello world!" />
117+
For advanced styling, check [the examples](./examples/styling.mdx).

docs/docs/upgrade-guide/basic-examples-v4-v5.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import ReactTooltip from 'react-tooltip';
4343
<ReactTooltip id="tooltip" place="top" type="dark" />
4444
```
4545

46-
(v4) `data-tip` = `data-content` (v5)
46+
(v4) `data-tip` = `data-tooltip-content` (v5)
4747

4848
- `V4` - CSS styles are built-in and injected by tooltip into the header (not a good practice but convenient), [issues in GitHub](https://github.com/ReactTooltip/react-tooltip/issues?q=is%3Aissue+header)
4949
- `V5` - CSS styles are optional and can be imported or not to the project
@@ -68,7 +68,7 @@ import 'react-tooltip/dist/react-tooltip.css'
6868
import { Tooltip } from 'react-tooltip';
6969
import 'react-tooltip/dist/react-tooltip.css';
7070

71-
<a id="attributes-basic" data-content="hello world!"> ◕‿‿◕ </a>
71+
<a id="attributes-basic" data-tooltip-content="hello world!"> ◕‿‿◕ </a>
7272

7373
<Tooltip anchorId="attributes-basic" />
7474
```

src/components/Tooltip/styles.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
.show {
3333
visibility: visible;
34-
opacity: 0.9;
34+
opacity: var(--rt-opacity);
3535
}
3636

3737
/** Types variant **/

src/tokens.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
--rt-color-error: #be6464;
66
--rt-color-warning: #f0ad4e;
77
--rt-color-info: #337ab7;
8+
--rt-opacity: 0.9;
89
}

0 commit comments

Comments
 (0)