Ok the question is simple. I need to make the dropdown open when mouse hover rather than on click.
Currently my code is as follow.
<Nav>
<NavDropdown
onMouseEnter = {()=> isOpen=true}
open={isOpen}
noCaret
id="language-switcher-container"
>
<MenuItem>Only one Item</MenuItem>
</NavDropdown>
</Nav>
as you can see, I tried onMouseEnter but no effect. Can someone solve this issue? What attribute should I pass in to achive this.
The API page is here react-bootstrap API page
Hope this solves your issue.
A much cleaner pure CSS solution here:
.dropdown:hover .dropdown-menu { display: block; }
This seems like a hacky solution, but it was the easiest way to keep my app running after updating.
With the latest update the
dropdown-menu
isn't rendered until the button is clicked.I've been using this in my css:
and added this to my component
I added a wrapping div with the given id just to click for this.
I'd love to hear another solution.
You could replicate this https://codepen.io/bsngr/pen/frDqh which uses the following JS
Or alternatively you could install a plugin like this https://github.com/CWSpear/bootstrap-hover-dropdown
EDIT: Perfectly fine solutions to bootstrap but I noticed now you said its react and I havent used that before but I dont see why the js above wouldnt work even if it requires tweaking