Skip to content

Commit 1301dd9

Browse files
gabrieljablonskiGabriel Jablonski
authored and
Gabriel Jablonski
committed
docs: clickable prop
1 parent d9573f9 commit 1301dd9

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

docs/docs/getting-started.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,32 @@ import { Tooltip } from 'react-tooltip'
9696
<Tooltip anchorId="my-anchor-element" />
9797
```
9898

99+
### Clickable tooltip
100+
101+
By default, you can't interact with elements inside the tooltip. To allow for proper usage of elements such as buttons and inputs, use the `clickable` prop.
102+
103+
```jsx
104+
<TooltipAnchor id="not-clickable">◕‿‿◕</TooltipAnchor>
105+
<Tooltip anchorId="not-clickable">
106+
<button>You can't click me :(</button>
107+
</Tooltip>
108+
<TooltipAnchor id="clickable">◕‿‿◕</TooltipAnchor>
109+
<Tooltip anchorId="clickable" clickable>
110+
<button>You can click me!</button>
111+
</Tooltip>
112+
```
113+
114+
<div style={{ display: 'flex', columnGap: '8px', justifyContent: 'center', paddingTop: '36px' }}>
115+
<TooltipAnchor id="not-clickable">◕‿‿◕</TooltipAnchor>
116+
<Tooltip anchorId="not-clickable">
117+
<button>You can't click me :(</button>
118+
</Tooltip>
119+
<TooltipAnchor id="clickable">◕‿‿◕</TooltipAnchor>
120+
<Tooltip anchorId="clickable" clickable>
121+
<button>You can click me!</button>
122+
</Tooltip>
123+
</div>
124+
99125
### Styling
100126

101127
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ import 'react-tooltip/dist/react-tooltip.css'
6868
| delayHide | number | false | | any `number` | tooltip hide will be delayed in miliseconds by the amount of value |
6969
| float | boolean | false | `false` | `true` `false` | tooltip will follow the mouse position when it moves inside the anchor element (same as V4's `effect="float"`) |
7070
| noArrow | boolean | false | `false` | `true` `false` | tooltip arrow will not be shown |
71+
| clickable | boolean | false | `false` | `true` `false` | allow interaction with elements inside the tooltip. useful when using buttons and inputs |
7172
| style | CSSProperties | false | | any React inline style | add styles directly to the component by `style` attribute |
7273
| position | `{ x: number; y: number }` | false | | any `number` value for both `x` and `y` | override the tooltip position on the viewport |
7374
| isOpen | boolen | false | handled by internal state | `true` `false` | the tooltip can be controlled or uncontrolled, this attribute can be used to handle show and hide tooltip outside tooltip (can be used **without** `setIsOpen`) |

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ V4 was a great react tooltip component but was built a few years ago, he was bui
7676
- [ ] `resizeHide` - if requested, can be implemented later
7777
- [x] `wrapper` - also available on anchor element as `data-tooltip-wrapper`
7878
- [ ] `bodyMode`
79-
- [ ] `clickable` - use controlled state to keep tooltip open
79+
- [x] `clickable`
8080
- [ ] `disableInternalStyle` - CSS will be a separate file and can be imported or not
8181

8282
### Detailed informations

0 commit comments

Comments
 (0)