Closed mohamed-isak closed 1 year ago
@mohamed-isak to be able to clear the Combobox value, you would need to fully control the value through the text
prop, and update it when the user selects a new value, or when you want to clear the input based on outside logic.
Here's a codepen demonstrating how to control the Combobox value/text
: https://codepen.io/smhigley/pen/NWONNea/e1e0b7f35e4abb5f687aeb9d93789c4b?editors=1010
Let me know if that answers your question!
Just as a side note -- you almost certainly also want to clear the selectedKey if you also clear the display value. You could alternately just clear the selectedKey and not control text
if you follow the "Controlled Combobox" pattern on our docs page: https://developer.microsoft.com/en-us/fluentui#/controls/web/combobox
when you want to clear the input based on outside logic.
this is my exact question i want to clear the user typed input on this. your above codepen example only clear the selected dropdown value. user typed value not clearing
Library
React Northstar / v0 (@fluentui/react-northstar)
System Info
Are you reporting Accessibility issue?
no
Reproduction
ok
Bug Description
Actual Behavior
I tried below code, I want to clear my allow free form user input text and I find Github PR in fluent ui github page for this issue i don't know how to use this: https://github.com/microsoft/fluentui/pull/5787
Expected Behavior
I want to clear user input in allow free form in combobox
Logs
No response
Requested priority
Blocking
Products/sites affected
No response
Are you willing to submit a PR to fix?
yes
Validations