Tooltip doesn't show when OverlayTrigger child is a custom React component
See original GitHub issueWhen I place a custom React component inside an OverlayTrigger
, it causes the tooltip to no longer display on mouse hover. Example:
function Avatar(props) {
return (<img src={props.url} />);
}
<OverlayTrigger overlay={(<Tooltip id="hi">Hello, world!</Tooltip>)} placement="top">
<Avatar url="http://i.imgur.com/cOkr6Um.gif" />
</OverlayTrigger>
Whereas the following does work:
<OverlayTrigger overlay={(<Tooltip id="hi">Hello, world!</Tooltip>)} placement="top">
<img src="http://i.imgur.com/cOkr6Um.gif" />
</OverlayTrigger>
(react-bootstrap@v0.30.2)
Issue Analytics
- State:
- Created 7 years ago
- Comments:18 (2 by maintainers)
Top Results From Across the Web
OverlayTrigger on custom component not working
I finally found a solution here: https://github.com/react-bootstrap ... Your custom component needs to pass the event handler props through.
Read more >Overlays | React-Bootstrap
The <Tooltip> and <Popover> components do not position themselves. Instead the <Overlay> (or <OverlayTrigger> ) components, inject ref and style props.
Read more >Tooltips | Trimble Modus React Bootstrap Developer Guide
Overview. The <Tooltip> component do not position itself. Instead the <Overlay> (or <OverlayTrigger> ) components, inject ref and style props.
Read more >[Solved]-React Bootstrap hide tooltip-Reactjs
React bootstrap Tooltip throws error 'React.Children.only expected to receive a single React element child.' ... How to position and resize React Bootstrap ...
Read more >React-Bootstrap OverlayTrigger Component - GeeksforGeeks
We can use the following approach in ReactJS to use the react-bootstrap OverlayTrigger Component. OverlayTrigger Props: children: It is used to ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
An easy fix is to wrap your custom component in an extra div:
@nielk