ui
ui copied to clipboard
How to not close the Dropdown Menu when Triggerer is Reclicked
I want to use the DropDown Trigger for the search bar and Dropdown Menu for the search results, Clicking on the Trigger again is closing the Dropdown menu, is there any way that I can stop this? Once Trigger is clicked, it should remain open until clicked outside, clicking again on the Dropdown trigger should not close the dropdown menu
https://ui.shadcn.com/docs/components/dropdown-menu
Hello @krishnaacharyaa,
Well, technically you have already answered your question. When you click on the Trigger, it opens a Dropdown menu. When you click outside the Dropdown menu, it closes and since the Trigger is outside the Dropdown menu, you get the expected behavior.
If I have understood your requirements correctly, I suggest you look at Combobox or Command components.
@iTsygancov Thank you for the answer, I took a look at both the above components,
Command looks fine but it doesn't close the search suggestions. And combobox has same problem that it gets collapsed when clicked again.
Is there any component or fix that i can make so that, I have a search component(For input and once clicked should open the overlay component and should not close on reclick) and a overlay component(Search results, which on clicking itself should not close, but when clicked outside should close.
Basically like a simple search component functionality, Any reproducible code suggestions would be really appreciated...!
This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.
Yes I have a problem like this, when I click it doesn't close again, because I added tag Link from next js, but if I use tag span there is no problem