react-tooltip 5.0.0-beta.1 → 5.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/.eslintrc.json +2 -1
  2. package/CODE_OF_CONDUCT.md +53 -0
  3. package/LICENSE +1 -2
  4. package/README.md +30 -152
  5. package/coverage/clover.xml +610 -0
  6. package/coverage/coverage-final.json +11 -0
  7. package/coverage/lcov-report/base.css +224 -0
  8. package/coverage/lcov-report/block-navigation.js +87 -0
  9. package/coverage/lcov-report/components/Tooltip/Tooltip.tsx.html +646 -0
  10. package/coverage/lcov-report/components/Tooltip/index.html +146 -0
  11. package/coverage/lcov-report/components/Tooltip/index.ts.html +88 -0
  12. package/coverage/lcov-report/components/Tooltip/styles.module.css.html +277 -0
  13. package/coverage/lcov-report/components/TooltipContent/TooltipContent.tsx.html +109 -0
  14. package/coverage/lcov-report/components/TooltipContent/index.html +131 -0
  15. package/coverage/lcov-report/components/TooltipContent/index.ts.html +88 -0
  16. package/coverage/lcov-report/components/TooltipController/TooltipController.tsx.html +664 -0
  17. package/coverage/lcov-report/components/TooltipController/constants.ts.html +118 -0
  18. package/coverage/lcov-report/components/TooltipController/index.html +146 -0
  19. package/coverage/lcov-report/components/TooltipController/index.ts.html +88 -0
  20. package/coverage/lcov-report/favicon.png +0 -0
  21. package/coverage/lcov-report/index.html +161 -0
  22. package/coverage/lcov-report/prettify.css +1 -0
  23. package/coverage/lcov-report/prettify.js +2 -0
  24. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  25. package/coverage/lcov-report/sorter.js +196 -0
  26. package/coverage/lcov-report/sum.js.html +97 -0
  27. package/coverage/lcov-report/sum.ts.html +100 -0
  28. package/coverage/lcov-report/test/index.html +116 -0
  29. package/coverage/lcov-report/test/sum.ts.html +100 -0
  30. package/coverage/lcov-report/utils/compute-positions.ts.html +277 -0
  31. package/coverage/lcov-report/utils/debounce.ts.html +181 -0
  32. package/coverage/lcov-report/utils/index.html +131 -0
  33. package/coverage/lcov.info +729 -0
  34. package/dist/react-tooltip.cjs.js +3 -6
  35. package/dist/react-tooltip.cjs.min.js +1 -1
  36. package/dist/react-tooltip.esm.js +3 -6
  37. package/dist/react-tooltip.esm.min.js +1 -1
  38. package/dist/react-tooltip.umd.js +3 -6
  39. package/dist/react-tooltip.umd.min.js +1 -1
  40. package/jest.config.ts +214 -0
  41. package/package.json +12 -4
  42. package/tsconfig.json +2 -2
  43. package/.github/FUNDING.yml +0 -13
  44. package/.github/workflows/lint.yaml +0 -35
  45. package/.github/workflows/pull-request.yaml +0 -11
  46. package/.github/workflows/release.yaml +0 -30
  47. package/.husky/pre-commit +0 -6
  48. package/.vscode/settings.json +0 -27
  49. package/build/dist/react-tooltip.cjs.js +0 -2909
  50. package/build/dist/react-tooltip.cjs.min.js +0 -6
  51. package/build/dist/react-tooltip.css +0 -73
  52. package/build/dist/react-tooltip.esm.js +0 -2901
  53. package/build/dist/react-tooltip.esm.min.js +0 -6
  54. package/build/dist/react-tooltip.min.css +0 -1
  55. package/build/dist/react-tooltip.umd.js +0 -2913
  56. package/build/dist/react-tooltip.umd.min.js +0 -6
  57. package/build/index.css +0 -79
  58. package/build/index.html +0 -19
  59. package/build/index.js +0 -36190
  60. package/docs/README.md +0 -50
  61. package/docs/babel.config.js +0 -3
  62. package/docs/docs/examples/_category_.json +0 -7
  63. package/docs/docs/examples/basic-examples.mdx +0 -68
  64. package/docs/docs/examples/children.mdx +0 -67
  65. package/docs/docs/examples/content.mdx +0 -80
  66. package/docs/docs/examples/delay.mdx +0 -84
  67. package/docs/docs/examples/events.mdx +0 -85
  68. package/docs/docs/examples/get-content.mdx +0 -58
  69. package/docs/docs/examples/html.mdx +0 -75
  70. package/docs/docs/examples/multiline.mdx +0 -91
  71. package/docs/docs/examples/offset.mdx +0 -69
  72. package/docs/docs/examples/place.mdx +0 -55
  73. package/docs/docs/examples/state.mdx +0 -331
  74. package/docs/docs/examples/styling.mdx +0 -388
  75. package/docs/docs/examples/variant.mdx +0 -100
  76. package/docs/docs/getting-started.mdx +0 -100
  77. package/docs/docs/options.mdx +0 -105
  78. package/docs/docs/upgrade-guide/_category_.json +0 -7
  79. package/docs/docs/upgrade-guide/basic-examples-v4-v5.mdx +0 -119
  80. package/docs/docs/upgrade-guide/changelog-v4-v5.md +0 -86
  81. package/docs/docusaurus.config.js +0 -135
  82. package/docs/package.json +0 -47
  83. package/docs/sidebars.js +0 -33
  84. package/docs/src/components/HomepageFeatures/index.tsx +0 -71
  85. package/docs/src/components/HomepageFeatures/styles.module.css +0 -11
  86. package/docs/src/css/custom.css +0 -74
  87. package/docs/src/pages/index.module.css +0 -35
  88. package/docs/src/pages/index.tsx +0 -45
  89. package/docs/src/pages/markdown-page.md +0 -7
  90. package/docs/static/.nojekyll +0 -0
  91. package/docs/static/img/Octocat.jpg +0 -0
  92. package/docs/static/img/Octocat.png +0 -0
  93. package/docs/static/img/Octocat.svg +0 -9
  94. package/docs/static/img/android-chrome-192x192.png +0 -0
  95. package/docs/static/img/android-chrome-512x512.png +0 -0
  96. package/docs/static/img/apple-touch-icon.png +0 -0
  97. package/docs/static/img/docusaurus.png +0 -0
  98. package/docs/static/img/favicon-16x16.png +0 -0
  99. package/docs/static/img/favicon-32x32.png +0 -0
  100. package/docs/static/img/favicon-old.ico +0 -0
  101. package/docs/static/img/favicon.ico +0 -0
  102. package/docs/static/img/github.svg +0 -1
  103. package/docs/static/img/happy-face-tooltip.png +0 -0
  104. package/docs/static/img/happy-face-tooltip.svg +0 -21
  105. package/docs/static/img/logo-dinossaur.svg +0 -1
  106. package/docs/static/img/logo.png +0 -0
  107. package/docs/static/img/logo.svg +0 -21
  108. package/docs/static/img/only-tooltip-top.png +0 -0
  109. package/docs/static/img/only-tooltip-top.svg +0 -4
  110. package/docs/static/img/only-tooltip.png +0 -0
  111. package/docs/static/img/only-tooltip.svg +0 -4
  112. package/docs/static/img/site.webmanifest +0 -1
  113. package/docs/static/img/undraw_docusaurus_mountain.svg +0 -171
  114. package/docs/static/img/undraw_docusaurus_react.svg +0 -170
  115. package/docs/static/img/undraw_docusaurus_tree.svg +0 -40
  116. package/docs/tsconfig.json +0 -7
  117. package/docs/yarn.lock +0 -7599
  118. package/example-v5/package.json +0 -21
  119. package/example-v5/public/index.html +0 -20
  120. package/example-v5/public/manifest.json +0 -8
  121. package/example-v5/src/App.jsx +0 -908
  122. package/example-v5/src/index.css +0 -238
  123. package/example-v5/src/index.js +0 -15
  124. package/example-v5/src/index.scss +0 -251
  125. package/public/index.html +0 -19
package/docs/README.md DELETED
@@ -1,50 +0,0 @@
1
- # Website
2
-
3
- This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
4
-
5
- ### Installation
6
-
7
- ```
8
- $ yarn
9
- ```
10
-
11
- ### Local Development
12
-
13
- You can link react packages and react-tooltip to this repository, but this should not be updated in github:
14
-
15
- In package.json:
16
- ```
17
- "react": "link:../node_modules/react",
18
- "react-dom": "link:../node_modules/react-dom",
19
- "react-tooltip": "link:.."
20
- ```
21
-
22
- ```
23
- $ yarn start
24
- ```
25
-
26
- This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
27
-
28
- ### Build
29
-
30
- ```
31
- $ yarn build
32
- ```
33
-
34
- This command generates static content into the `build` directory and can be served using any static contents hosting service.
35
-
36
- ### Deployment
37
-
38
- Using SSH:
39
-
40
- ```
41
- $ USE_SSH=true yarn deploy
42
- ```
43
-
44
- Not using SSH:
45
-
46
- ```
47
- $ GIT_USER=<Your GitHub username> yarn deploy
48
- ```
49
-
50
- If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3
- };
@@ -1,7 +0,0 @@
1
- {
2
- "label": "Examples",
3
- "position": 4,
4
- "link": {
5
- "type": "generated-index"
6
- }
7
- }
@@ -1,68 +0,0 @@
1
- ---
2
- sidebar_position: 1
3
- ---
4
-
5
- # Basic examples
6
-
7
- Basic examples of use ReactTooltip component.
8
-
9
- import { Tooltip } from 'react-tooltip'
10
- import 'react-tooltip/dist/react-tooltip.css'
11
-
12
- export const TooltipAnchor = ({ children, id, ...rest }) => {
13
- return (
14
- <span
15
- id={id}
16
- style={{
17
- display: 'flex',
18
- justifyContent: 'center',
19
- alignItems: 'center',
20
- width: '60px',
21
- height: '60px',
22
- borderRadius: '60px',
23
- color: '#222',
24
- background: 'rgba(255, 255, 255, 1)',
25
- cursor: 'pointer',
26
- boxShadow: '3px 4px 3px rgba(0, 0, 0, 0.5)',
27
- border: '1px solid #333',
28
- }}
29
- {...rest}
30
- >
31
- {children}
32
- </span>
33
- )
34
- }
35
-
36
- ### Props
37
-
38
- ```jsx
39
- import { Tooltip } from 'react-tooltip';
40
- import 'react-tooltip/dist/react-tooltip.css'
41
-
42
- <a id="props-basic"> ◕‿‿◕ </a>
43
-
44
- <Tooltip anchorId="props-basic" content="hello world!" />
45
- ```
46
-
47
- <TooltipAnchor id="props-basic">◕‿‿◕</TooltipAnchor>
48
- <Tooltip anchorId="props-basic" content="hello world!" />
49
-
50
- ### Data attributes
51
-
52
- ```jsx
53
- import { Tooltip } from 'react-tooltip';
54
- import 'react-tooltip/dist/react-tooltip.css';
55
-
56
- <a id="attributes-basic" data-tooltip-content="hello world!"> ◕‿‿◕ </a>
57
-
58
- <Tooltip anchorId="attributes-basic" />
59
- ```
60
-
61
- <TooltipAnchor id="attributes-basic" data-tooltip-content="hello world!">
62
- ◕‿‿◕
63
- </TooltipAnchor>
64
- <Tooltip anchorId="attributes-basic" />
65
-
66
- ---
67
-
68
- To check all available options, please check `options` docs
@@ -1,67 +0,0 @@
1
- ---
2
- sidebar_position: 1
3
- ---
4
-
5
- # Children
6
-
7
- Children for content example of ReactTooltip component use case.
8
-
9
- import { Tooltip } from 'react-tooltip'
10
- import 'react-tooltip/dist/react-tooltip.css'
11
-
12
- export const TooltipAnchor = ({ children, id, ...rest }) => {
13
- return (
14
- <span
15
- id={id}
16
- style={{
17
- display: 'flex',
18
- justifyContent: 'center',
19
- alignItems: 'center',
20
- width: '60px',
21
- height: '60px',
22
- borderRadius: '60px',
23
- color: '#222',
24
- background: 'rgba(255, 255, 255, 1)',
25
- cursor: 'pointer',
26
- boxShadow: '3px 4px 3px rgba(0, 0, 0, 0.5)',
27
- border: '1px solid #333',
28
- }}
29
- {...rest}
30
- >
31
- {children}
32
- </span>
33
- )
34
- }
35
-
36
- ### Using `children` as content
37
-
38
- When using `children` as content, `content` and `html` params will be ignored and only children will be shown.
39
-
40
- ```jsx
41
- import { Tooltip } from 'react-tooltip';
42
- import 'react-tooltip/dist/react-tooltip.css';
43
-
44
- <a id="tooltip-anchor-children"> ◕‿‿◕ </a>
45
- <Tooltip anchorId="tooltip-anchor-children">
46
- <div>
47
- <h1>Tooltip</h1>
48
- <ul>
49
- <li>Lorem</li>
50
- <li>Ipsum</li>
51
- </ul>
52
- </div>
53
- </Tooltip>
54
- ```
55
-
56
- <div style={{ display: 'flex', columnGap: '16px', justifyContent: 'center', paddingTop: '36px' }}>
57
- <TooltipAnchor id="tooltip-anchor-children">◕‿‿◕</TooltipAnchor>
58
- <Tooltip anchorId="tooltip-anchor-children">
59
- <div>
60
- <h1>Tooltip</h1>
61
- <ul>
62
- <li>Lorem</li>
63
- <li>Ipsum</li>
64
- </ul>
65
- </div>
66
- </Tooltip>
67
- </div>
@@ -1,80 +0,0 @@
1
- ---
2
- sidebar_position: 1
3
- ---
4
-
5
- # Content
6
-
7
- Content in ReactTooltip component.
8
-
9
- import { Tooltip } from 'react-tooltip'
10
- import 'react-tooltip/dist/react-tooltip.css'
11
-
12
- export const TooltipAnchor = ({ children, id, ...rest }) => {
13
- return (
14
- <span
15
- id={id}
16
- style={{
17
- display: 'flex',
18
- justifyContent: 'center',
19
- alignItems: 'center',
20
- width: '60px',
21
- height: '60px',
22
- borderRadius: '60px',
23
- color: '#222',
24
- background: 'rgba(255, 255, 255, 1)',
25
- cursor: 'pointer',
26
- boxShadow: '3px 4px 3px rgba(0, 0, 0, 0.5)',
27
- border: '1px solid #333',
28
- }}
29
- {...rest}
30
- >
31
- {children}
32
- </span>
33
- )
34
- }
35
-
36
- ### Using `content`
37
-
38
- ```jsx
39
- import { Tooltip } from 'react-tooltip';
40
- import 'react-tooltip/dist/react-tooltip.css';
41
-
42
- <a id="tooltip-anchor"> ◕‿‿◕ </a>
43
- <Tooltip anchorId="tooltip-anchor" content="Hello<br /><s>multiline</s><br /><b>HTML</b><br />tooltip" place="left" />
44
- ```
45
-
46
- <div style={{ display: 'flex', columnGap: '16px', justifyContent: 'center', paddingTop: '36px' }}>
47
- <TooltipAnchor id="tooltip-anchor">◕‿‿◕</TooltipAnchor>
48
- <Tooltip
49
- anchorId="tooltip-anchor"
50
- content="Hello<br /><s>multiline</s><br /><b>HTML</b><br />tooltip"
51
- />
52
- </div>
53
-
54
- ### Using `data-tooltip-content`
55
-
56
- ```jsx
57
- import { Tooltip } from 'react-tooltip';
58
- import 'react-tooltip/dist/react-tooltip.css';
59
-
60
- <a
61
- id="tooltip-anchor-data-html"
62
- data-tooltip-content="<div><h1>Tooltip</h1><ul><li>Lorem</li><li>Ipsum</li></ul></div>"
63
- > ◕‿‿◕ </a>
64
- <Tooltip anchorId="tooltip-anchor-data-html" />
65
- ```
66
-
67
- <div style={{ display: 'flex', columnGap: '16px', justifyContent: 'center', paddingTop: '36px' }}>
68
- <TooltipAnchor
69
- id="tooltip-anchor-html"
70
- data-tooltip-content="<div><h1>Tooltip</h1><ul><li>Lorem</li><li>Ipsum</li></ul></div>"
71
- >
72
- ◕‿‿◕
73
- </TooltipAnchor>
74
- <Tooltip anchorId="tooltip-anchor-html" />
75
- </div>
76
-
77
- #### Observations
78
-
79
- - When using `data-tooltip-content` the HTML tags works by default like [HTML](./html.mdx) param
80
- - When using prop `content` the HTML doesn't work by default, use prop `html` instead of this
@@ -1,84 +0,0 @@
1
- ---
2
- sidebar_position: 1
3
- ---
4
-
5
- # Delays
6
-
7
- Delays available in ReactTooltip component.
8
-
9
- import { Tooltip } from 'react-tooltip'
10
- import 'react-tooltip/dist/react-tooltip.css'
11
-
12
- export const TooltipAnchor = ({ children, id, ...rest }) => {
13
- return (
14
- <span
15
- id={id}
16
- style={{
17
- display: 'flex',
18
- justifyContent: 'center',
19
- alignItems: 'center',
20
- width: '60px',
21
- height: '60px',
22
- borderRadius: '60px',
23
- color: '#222',
24
- background: 'rgba(255, 255, 255, 1)',
25
- cursor: 'pointer',
26
- boxShadow: '3px 4px 3px rgba(0, 0, 0, 0.5)',
27
- border: '1px solid #333',
28
- }}
29
- {...rest}
30
- >
31
- {children}
32
- </span>
33
- )
34
- }
35
-
36
- ### Delay to Hide tooltip
37
-
38
- ```jsx
39
- import { Tooltip } from 'react-tooltip';
40
- import 'react-tooltip/dist/react-tooltip.css';
41
-
42
- <a
43
- id="tooltip-anchor-hide"
44
- data-tooltip-content="hover on me will keep the tooltip"
45
- data-tooltip-delay-hide={3000}
46
- > ◕‿‿◕ </a>
47
- <Tooltip anchorId="tooltip-anchor-hide" />
48
- ```
49
-
50
- <div style={{ display: 'flex', columnGap: '16px', justifyContent: 'center', paddingTop: '36px' }}>
51
- <TooltipAnchor
52
- id="tooltip-anchor-hide"
53
- data-tooltip-content="hover on me will keep the tooltip"
54
- data-tooltip-delay-hide={3000}
55
- >
56
- ◕‿‿◕
57
- </TooltipAnchor>
58
- <Tooltip anchorId="tooltip-anchor-hide" />
59
- </div>
60
-
61
- ### Delay to Show tooltip
62
-
63
- ```jsx
64
- import { Tooltip } from 'react-tooltip';
65
- import 'react-tooltip/dist/react-tooltip.css';
66
-
67
- <a
68
- id="tooltip-anchor-show"
69
- data-tooltip-content="hover on me will keep the tooltip"
70
- data-tooltip-delay-show={3000}
71
- > ◕‿‿◕ </a>
72
- <Tooltip anchorId="tooltip-anchor-show" />
73
- ```
74
-
75
- <div style={{ display: 'flex', columnGap: '16px', justifyContent: 'center', paddingTop: '36px' }}>
76
- <TooltipAnchor
77
- id="tooltip-anchor-show"
78
- data-tooltip-content="hover on me will keep the tooltip"
79
- data-tooltip-delay-show={3000}
80
- >
81
- ◕‿‿◕
82
- </TooltipAnchor>
83
- <Tooltip anchorId="tooltip-anchor-show" />
84
- </div>
@@ -1,85 +0,0 @@
1
- ---
2
- sidebar_position: 1
3
- ---
4
-
5
- # Events
6
-
7
- Events available in ReactTooltip component.
8
-
9
- import { Tooltip } from 'react-tooltip'
10
- import 'react-tooltip/dist/react-tooltip.css'
11
-
12
- export const TooltipAnchor = ({ children, id, ...rest }) => {
13
- return (
14
- <span
15
- id={id}
16
- style={{
17
- display: 'flex',
18
- justifyContent: 'center',
19
- alignItems: 'center',
20
- width: '60px',
21
- height: '60px',
22
- borderRadius: '60px',
23
- color: '#222',
24
- background: 'rgba(255, 255, 255, 1)',
25
- cursor: 'pointer',
26
- boxShadow: '3px 4px 3px rgba(0, 0, 0, 0.5)',
27
- border: '1px solid #333',
28
- }}
29
- {...rest}
30
- >
31
- {children}
32
- </span>
33
- )
34
- }
35
-
36
- ### Using `hover`
37
-
38
- This is the default of ReactTooltip events options.
39
-
40
- ```jsx
41
- import { Tooltip } from 'react-tooltip';
42
- import 'react-tooltip/dist/react-tooltip.css';
43
-
44
- <a id="tooltip-anchor"> ◕‿‿◕ </a>
45
- <Tooltip anchorId="tooltip-anchor" content="Hello World!" events={['hover']} />
46
- ```
47
-
48
- <div style={{ display: 'flex', columnGap: '16px', justifyContent: 'center', paddingTop: '36px' }}>
49
- <TooltipAnchor id="tooltip-anchor">◕‿‿◕</TooltipAnchor>
50
- <Tooltip anchorId="tooltip-anchor" content="Hello World!" events={['hover']} />
51
- </div>
52
-
53
- ### Using `click`
54
-
55
- ```jsx
56
- import { Tooltip } from 'react-tooltip';
57
- import 'react-tooltip/dist/react-tooltip.css';
58
-
59
- <a id="tooltip-anchor-click"> ◕‿‿◕ </a>
60
- <Tooltip anchorId="tooltip-anchor-click" content="Hello World!" events={['click']} />
61
- ```
62
-
63
- <div style={{ display: 'flex', columnGap: '16px', justifyContent: 'center', paddingTop: '36px' }}>
64
- <TooltipAnchor id="tooltip-anchor-click">◕‿‿◕</TooltipAnchor>
65
- <Tooltip anchorId="tooltip-anchor-click" content="Hello World!" events={['click']} />
66
- </div>
67
-
68
- ### Using `hover` and `click`
69
-
70
- ```jsx
71
- import { Tooltip } from 'react-tooltip';
72
- import 'react-tooltip/dist/react-tooltip.css';
73
-
74
- <a id="tooltip-anchor-hover-click"> ◕‿‿◕ </a>
75
- <Tooltip anchorId="tooltip-anchor-hover-click" content="Hello World!" events={['hover', 'click']} />
76
- ```
77
-
78
- <div style={{ display: 'flex', columnGap: '16px', justifyContent: 'center', paddingTop: '36px' }}>
79
- <TooltipAnchor id="tooltip-anchor-hover-click">◕‿‿◕</TooltipAnchor>
80
- <Tooltip
81
- anchorId="tooltip-anchor-hover-click"
82
- content="Hello World!"
83
- events={['hover', 'click']}
84
- />
85
- </div>
@@ -1,58 +0,0 @@
1
- ---
2
- sidebar_position: 1
3
- ---
4
-
5
- # GetContent
6
-
7
- Get content param in ReactTooltip component.
8
-
9
- import { Tooltip } from 'react-tooltip'
10
- import 'react-tooltip/dist/react-tooltip.css'
11
-
12
- export const TooltipAnchor = ({ children, id, ...rest }) => {
13
- return (
14
- <span
15
- id={id}
16
- style={{
17
- display: 'flex',
18
- justifyContent: 'center',
19
- alignItems: 'center',
20
- width: '60px',
21
- height: '60px',
22
- borderRadius: '60px',
23
- color: '#222',
24
- background: 'rgba(255, 255, 255, 1)',
25
- cursor: 'pointer',
26
- boxShadow: '3px 4px 3px rgba(0, 0, 0, 0.5)',
27
- border: '1px solid #333',
28
- }}
29
- {...rest}
30
- >
31
- {children}
32
- </span>
33
- )
34
- }
35
-
36
- ### Using `getContent` prop
37
-
38
- ```jsx
39
- import { Tooltip } from 'react-tooltip';
40
- import 'react-tooltip/dist/react-tooltip.css';
41
-
42
- <a id="tooltip-anchor"> ◕‿‿◕ </a>
43
- <Tooltip
44
- anchorId="tooltip-anchor"
45
- content="Hello World from"
46
- place="left"
47
- getContent={(value) => `${value} manipuled message`}
48
- />
49
- ```
50
-
51
- <div style={{ display: 'flex', columnGap: '16px', justifyContent: 'center', paddingTop: '36px' }}>
52
- <TooltipAnchor id="tooltip-anchor">◕‿‿◕</TooltipAnchor>
53
- <Tooltip
54
- anchorId="tooltip-anchor"
55
- content="Hello World from"
56
- getContent={(value) => `${value} manipuled message`}
57
- />
58
- </div>
@@ -1,75 +0,0 @@
1
- ---
2
- sidebar_position: 1
3
- ---
4
-
5
- # HTML
6
-
7
- HTML content in ReactTooltip component.
8
-
9
- import { Tooltip } from 'react-tooltip'
10
- import 'react-tooltip/dist/react-tooltip.css'
11
-
12
- export const TooltipAnchor = ({ children, id, ...rest }) => {
13
- return (
14
- <span
15
- id={id}
16
- style={{
17
- display: 'flex',
18
- justifyContent: 'center',
19
- alignItems: 'center',
20
- width: '60px',
21
- height: '60px',
22
- borderRadius: '60px',
23
- color: '#222',
24
- background: 'rgba(255, 255, 255, 1)',
25
- cursor: 'pointer',
26
- boxShadow: '3px 4px 3px rgba(0, 0, 0, 0.5)',
27
- border: '1px solid #333',
28
- }}
29
- {...rest}
30
- >
31
- {children}
32
- </span>
33
- )
34
- }
35
-
36
- ### Using `html`
37
-
38
- ```jsx
39
- import { Tooltip } from 'react-tooltip';
40
- import 'react-tooltip/dist/react-tooltip.css';
41
-
42
- <a id="tooltip-anchor"> ◕‿‿◕ </a>
43
- <Tooltip anchorId="tooltip-anchor" html="Hello<br /><s>multiline</s><br /><b>HTML</b><br />tooltip" place="left" />
44
- ```
45
-
46
- <div style={{ display: 'flex', columnGap: '16px', justifyContent: 'center', paddingTop: '36px' }}>
47
- <TooltipAnchor id="tooltip-anchor">◕‿‿◕</TooltipAnchor>
48
- <Tooltip
49
- anchorId="tooltip-anchor"
50
- html="Hello<br /><s>multiline</s><br /><b>HTML</b><br />tooltip"
51
- />
52
- </div>
53
-
54
- ### Using `data-tooltip-html`
55
-
56
- ```jsx
57
- import { Tooltip } from 'react-tooltip';
58
- import 'react-tooltip/dist/react-tooltip.css';
59
-
60
- <a
61
- id="tooltip-anchor-data-html"
62
- data-tooltip-html="<div><h1>Tooltip</h1><ul><li>Lorem</li><li>Ipsum</li></ul></div>"
63
- > ◕‿‿◕ </a>
64
- <Tooltip anchorId="tooltip-anchor-data-html" />
65
- ```
66
-
67
- <div style={{ display: 'flex', columnGap: '16px', justifyContent: 'center', paddingTop: '36px' }}>
68
- <TooltipAnchor
69
- id="tooltip-anchor-html"
70
- data-tooltip-html="<div><h1>Tooltip</h1><ul><li>Lorem</li><li>Ipsum</li></ul></div>"
71
- >
72
- ◕‿‿◕
73
- </TooltipAnchor>
74
- <Tooltip anchorId="tooltip-anchor-html" />
75
- </div>
@@ -1,91 +0,0 @@
1
- ---
2
- sidebar_position: 1
3
- ---
4
-
5
- # Multiline
6
-
7
- Multiline content in ReactTooltip component.
8
-
9
- import { Tooltip } from 'react-tooltip'
10
- import 'react-tooltip/dist/react-tooltip.css'
11
-
12
- export const TooltipAnchor = ({ children, id, ...rest }) => {
13
- return (
14
- <span
15
- id={id}
16
- style={{
17
- display: 'flex',
18
- justifyContent: 'center',
19
- alignItems: 'center',
20
- width: '60px',
21
- height: '60px',
22
- borderRadius: '60px',
23
- color: '#222',
24
- background: 'rgba(255, 255, 255, 1)',
25
- cursor: 'pointer',
26
- boxShadow: '3px 4px 3px rgba(0, 0, 0, 0.5)',
27
- border: '1px solid #333',
28
- }}
29
- {...rest}
30
- >
31
- {children}
32
- </span>
33
- )
34
- }
35
-
36
- ### Using `html`
37
-
38
- ```jsx
39
- import { Tooltip } from 'react-tooltip';
40
- import 'react-tooltip/dist/react-tooltip.css';
41
-
42
- <a id="tooltip-anchor"> ◕‿‿◕ </a>
43
- <Tooltip anchorId="tooltip-anchor" html="Hello<br />multiline<br />tooltip" />
44
- ```
45
-
46
- <div style={{ display: 'flex', columnGap: '16px', justifyContent: 'center', paddingTop: '36px' }}>
47
- <TooltipAnchor id="tooltip-anchor">◕‿‿◕</TooltipAnchor>
48
- <Tooltip anchorId="tooltip-anchor" html="Hello<br />multiline<br />tooltip" />
49
- </div>
50
-
51
- ### Using `data-tooltip-content`
52
-
53
- ```jsx
54
- import { Tooltip } from 'react-tooltip';
55
- import 'react-tooltip/dist/react-tooltip.css';
56
-
57
- <a id="tooltip-anchor-data-content" data-tooltip-content="Hello<br />multiline<br />tooltip"> ◕‿‿◕ </a>
58
- <Tooltip anchorId="tooltip-anchor-data-content" />
59
- ```
60
-
61
- <div style={{ display: 'flex', columnGap: '16px', justifyContent: 'center', paddingTop: '36px' }}>
62
- <TooltipAnchor
63
- id="tooltip-anchor-data-content"
64
- data-tooltip-content="Hello<br />multiline<br />tooltip"
65
- >
66
- ◕‿‿◕
67
- </TooltipAnchor>
68
- <Tooltip anchorId="tooltip-anchor-data-content" />
69
- </div>
70
-
71
- ### Using `data-tooltip-html`
72
-
73
- ```jsx
74
- import { Tooltip } from 'react-tooltip';
75
- import 'react-tooltip/dist/react-tooltip.css';
76
-
77
- <a id="tooltip-anchor-data-html" data-tooltip-html="Hello<br />multiline<br />tooltip"> ◕‿‿◕ </a>
78
- <Tooltip anchorId="tooltip-anchor-data-html" />
79
- ```
80
-
81
- <div style={{ display: 'flex', columnGap: '16px', justifyContent: 'center', paddingTop: '36px' }}>
82
- <TooltipAnchor id="tooltip-anchor-html" data-tooltip-html="Hello<br />multiline<br />tooltip">
83
- ◕‿‿◕
84
- </TooltipAnchor>
85
- <Tooltip anchorId="tooltip-anchor-html" />
86
- </div>
87
-
88
- #### Observations
89
-
90
- - When using `data-tooltip-content` the `<br />` works by default
91
- - When using prop `content` the `<br />` doesn't work by default, use prop `html` instead of this