I am using DropdownButton
from react-bootstrap to create a dropdown with custom content. In the content the user can select various options and the click a button inside the dropdown to submit the selected options.
The problem I am facing is that I am unable to close the dropdown when the user clicks the submit button.
This is my code:
<DropdownButton
title={ name }
variant="outline-secondary"
onToggle={ this.handleDropdownToggle }
>
<div className="body">
{ this.renderOptions(options) }
</div>
<div className="filter-submit">
<Button variant="primary" onClick={ this.onSubmit }>
Accept
</Button>
</div>
</DropdownButton>
If I use the Dropdown
element with Dropdown.Toggle
Dropdown.menu
and the show
property, I can control the visibility, but it disables the ability to close the dropdown when clicking outside it.