Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example to docs for Combobox that uses value property #372

Open
glennpierce opened this issue Feb 6, 2025 · 3 comments
Open

Add example to docs for Combobox that uses value property #372

glennpierce opened this issue Feb 6, 2025 · 3 comments
Milestone

Comments

@glennpierce
Copy link

Combobox has a property and i can't find and example of using it.

value Model

The examples all use selected_options even when the first couple of examples are single strings should they not use value ?

What is the difference between value and selected_options ?

I am trying to fix a bug where updating selected_options does not change the dropdown and thinking it would be easier with value.

Thanks

@luoxiaozero
Copy link
Collaborator

What is the difference between value and selected_options ?

  • The value attribute is the value displayed in the input box, usually the text attribute of the selected ComboboxOption component.
  • selected_options is the value attribute of the selected ComboboxOption component.

I am trying to fix a bug where updating selected_options does not change the dropdown and thinking it would be easier with value.

The reason why the selected_options is updated without changing the drop-down menu is to match the behavior of Fluent.

https://react.fluentui.dev/?path=/docs/components-combobox--docs#controlled

@glennpierce
Copy link
Author

So if I understand correctly, if I need the force the combobox to change in code I could fake it by setting value ? or would that show a mismatch when opening the dropdown. What would be your suggestion for this case ?

@luoxiaozero
Copy link
Collaborator

My current suggestion is to set the value of value when you update the selected_options value.

However, in the next version (V5), maybe we should consider automatically setting the value of value when the user updates the selected_options value.

@luoxiaozero luoxiaozero added this to the 0.5 milestone Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants