Multiselect ?
#2242
Replies: 1 comment
-
If you attach a click handler to the document and you have a ref to your dropdown, you can use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am trying to implement a select input that can take multiple values.
I sort of manage to have evertything working by creating a component that holds the value as an array, by rendering the value manually as an array of elements, and by rendering the options in the dropdown with a different style based on my internal value.
So far so good.
My only issue is that whenever I click on an element on the dropdown it closes, which is not ideal for a multiselect.
There are
open
andonOpenChange
props in the root primitive, butonOpenChange
will fire every time.My question is, is there a way to distinguish when the user is clicking on an element of the dropdown or outisde of it, so I can control the open state?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions