Skip to content

set combobox open menu without using useComboboxPrimitive #2350

Answered by TheSisb
azhengtwilio asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @azhengtwilio,

Is there a way where I can set the Combobox dropdown menu to open based on certain conditions without me having to use useComboboxPrimitive's openMenu? I only see initialIsOpen in the Combobox doc.

Opening the Combobox menu programmatically is possible with the state hook useCombobox from the non-primitive component. Here's an example of how it would work. This is the only way to tap into that functionality.

I am trying to implement an Anchor link in a toast that will open the dropdown when clicked on

Please do be aware that Anchors are for hyperlinking to another URL and that Buttons trigger an action. In this instance, you likely want a Button. Please consider the l…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@azhengtwilio
Comment options

@azhengtwilio
Comment options

@TheSisb
Comment options

Answer selected by TheSisb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants