Skip to content

Commit c833dfe

Browse files
authored
Merge pull request #864 from ReactTooltip/fix-docs-v5
docs: fix docs references to new `data-tooltip-*` attributes
2 parents 49fc47d + b0184db commit c833dfe

File tree

5 files changed

+26
-29
lines changed

5 files changed

+26
-29
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: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,49 +56,46 @@ 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-
### Styling
94-
95-
If you want a styled tooltip, don't forget to add the style file `import 'react-tooltip/dist/react-tooltip.css`
96-
97-
3 . Include react-tooltip component
93+
3 . Create `<Tooltip />` element
9894

9995
```jsx
100-
<ReactTooltip anchorId="my-anchor-element" />
96+
<Tooltip anchorId="my-anchor-element" />
10197
```
10298

103-
<TooltipAnchor id="props-basic">◕‿‿◕</TooltipAnchor>
104-
<Tooltip anchorId="props-basic" content="hello world!" />
99+
### Styling
100+
101+
If you want a styled tooltip, don't forget to add the style file `import 'react-tooltip/dist/react-tooltip.css`

docs/docs/options.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ import 'react-tooltip/dist/react-tooltip.css'
7777
import { Tooltip } from 'react-tooltip';
7878
import 'react-tooltip/dist/react-tooltip.css';
7979

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

8282
<Tooltip anchorId="attributes-basic" />
8383
```
8484

85-
<TooltipAnchor id="attributes-basic" data-content="hello world!">
85+
<TooltipAnchor id="attributes-basic" data-tooltip-content="hello world!">
8686
◕‿‿◕
8787
</TooltipAnchor>
8888
<Tooltip anchorId="attributes-basic" />

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
```

docs/docs/upgrade-guide/changelog-v4-v5.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,24 @@ V4 was a great react tooltip component but was built a few years ago, he was bui
2626
- Exported module now is `Tooltip` instead of `ReactTooltip`
2727
- - If you already have a `Tooltip` component in your application and want to explicitly declare this is `ReactTooltip`, just `import { Tooltip as ReactTooltip } from "react-tooltip"`
2828
- CSS import is now optional, so, you can modify and/or add any styling to your floating tooltip element
29-
- `data-tip` attribute now is `data-content`
29+
- `data-tip` attribute now is `data-tooltip-content`
3030
- `getContent` prop was removed. Instead, you can directly pass dynamic content to the `content` tooltip prop, or to `data-tooltip-content`
3131
- default behavior of tooltip now is `solid` instead of `float`
3232

3333
## New Props
3434

3535
- [x] classNameArrow
36-
- [x] events - `data-events` -`['hover', 'click']` - default: `['hover']` (always an array when using as prop, even with only one option, when using as data attribute: `data-events="hover click"`)
36+
- [x] events - `data-tooltip-events` -`['hover', 'click']` - default: `['hover']` (always an array when using as prop, even with only one option, when using as data attribute: `data-tooltip-events="hover click"`)
3737
- [x] isOpen - `boolean` (to control tooltip state) - if not used, internal state of tooltip will handle the show state
3838
- [x] setIsOpen - `function` (to control tooltip state) - if not used, internal state of tooltip will handle the show state
3939

4040
## `V4` props available in `V5`
4141

4242
- [x] children
43-
- [x] place - `data-place`
44-
- [x] type - **Deprecated** | in V5 -> `variant` - `data-variant`
43+
- [x] place - `data-tooltip-place`
44+
- [x] type - **Deprecated** | in V5 -> `variant` - `data-tooltip-variant`
4545
- [ ] effect - not implemented yet, if many users need this feature, we will work on this one.
46-
- [x] offset - `data-offset`
46+
- [x] offset - `data-tooltip-offset`
4747
- [ ] padding - **Deprecated** | in V5 -> can be easy updated by className prop
4848
- [ ] multiline - **Deprecated** | in V5 -> this is already supported as default by `content` and `html` props
4949
- [ ] border - **Deprecated** | in V5 -> can be easy updated by `className` prop
@@ -58,9 +58,9 @@ V4 was a great react tooltip component but was built a few years ago, he was bui
5858
- [x] className
5959
- [x] id
6060
- [x] html
61-
- [x] delayHide - `data-delay-hide`
61+
- [x] delayHide - `data-tooltip-delay-hide`
6262
- [ ] delayUpdate - **Deprecated** | if requested, can be implemented later
63-
- [x] delayShow - `data-delay-show`
63+
- [x] delayShow - `data-tooltip-delay-show`
6464
- [ ] event - not implemented yet, if many users need this feature, we will work on this one.
6565
- [ ] eventOff - **Deprecated**
6666
- [ ] isCapture - **Deprecated**
@@ -72,7 +72,7 @@ V4 was a great react tooltip component but was built a few years ago, he was bui
7272
- [ ] disable - **Deprecated** | in V5 -> state can be controlled or uncontrolled
7373
- [ ] scrollHide - not implemented yet, if many users need this feature, we will validate if we wrok on this one.
7474
- [ ] resizeHide - not implemented yet, if many users need this feature, we will validate if we wrok on this one.
75-
- [x] wrapper - `data-wrapper`
75+
- [x] wrapper - `data-tooltip-wrapper`
7676
- [ ] bodyMode - **Deprecated**
7777
- [ ] clickable - **Deprecated** | Supported by default in V5
7878
- [ ] disableInternalStyle - **Deprecated** | in V5 -> CSS will be a separate file and can be imported or not

0 commit comments

Comments
 (0)