Does the Dropdown component's value prop serve any purpose when the component has the multiselect prop set to true? #31845
-
|
Hi! I'm putting together a controlled Dropdown component that looks something like this. I have a handler that pulls the Is there a purpose to having the Thanks for any insight/context! :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Essentially, in this particular code example, no. The TL:DR; it looks like you're customizing the |
Beta Was this translation helpful? Give feedback.
Essentially, in this particular code example, no.
The
valueprop onDropdownwill control the text that is displayed in the trigger button (unless you override this by passing in your own trigger button children with thebuttonslot). It will default to showing the text of the selected options (comma-delimited for multiselect), but if you control theselectedOptionsprop you'd also need to pass in either an explicitvalueprop or customize thebuttonslot so it's correct on the initial render before being opened. The reason for that is that Options are not rendered before the Dropdown is first focused & opened, so it doesn't have access to the initial selected option data to calculate the…