Skip to content

Does the Dropdown component's value prop serve any purpose when the component has the multiselect prop set to true? #31845

Answered by smhigley
nathaniellee asked this question in Q&A
Discussion options

You must be logged in to vote

Essentially, in this particular code example, no.

The value prop on Dropdown will control the text that is displayed in the trigger button (unless you override this by passing in your own trigger button children with the button slot). It will default to showing the text of the selected options (comma-delimited for multiselect), but if you control the selectedOptions prop you'd also need to pass in either an explicit value prop or customize the button slot 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…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by khmakoto
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