Combobox default & filter use case #1067
-
Hi there, I have a use case for a combobox or select autocomplete interaction that differs slightly from the examples, and am wondering if it's achievable or whether there is a better pattern/component to use as an alternative. Use Case: A few requirements/constraints:
Ultimately I tried mocking something inspired by the useCombobox state hook example, but the x-ing out feels a little unnatural and perhaps more complicated than it needs to be. An ideal/simpler solution might work more like this first single selection example from Morningstar's design system, except with the ability to set something as the default. What I like about this implementation:
Happy to bring this to DSYS office hours as a next step but wanted to see if anyone had immediate ideas for alt solutions or whether this is feasible with the current component. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hi @seanmateer, You can pass an initial value to the simple combobox with the Curious if you considered using a Select component as well? |
Beta Was this translation helpful? Give feedback.
-
Hi @seanmateer In reference to your proposed solution, all of this should be possible but at this point we've not tested anything. From a UX perspective, we agree with your hunch about "x-ing" out. That can probably be dropped. Clicking into the field in order to "clear" the selection, while maintaining the previous selection feels like a good approach. Engineering will most likely need to use the state hook within Combobox, since that will give them the most control of the combobox functionality. Some parts, like the event handling will be a little tricky. We're happy to help support the engineering team when they're building this. If you want to chat more about this, feel free to schedule some time in office hours. |
Beta Was this translation helpful? Give feedback.
-
Thanks both @TheSisb and @richbachman. Open to the same implementation with a Select field if it's easier, though I'm partial to the fancy styling of the combobox :) As a next step I am going to tag @alfredlucero just to get him up to speed on this discussion and we will follow up in implementation if we have any issues. You can probably resolve this issue in the meantime. Thank you! |
Beta Was this translation helpful? Give feedback.
Hi @seanmateer
In reference to your proposed solution, all of this should be possible but at this point we've not tested anything.
From a UX perspective, we agree with your hunch about "x-ing" out. That can probably be dropped. Clicking into the field in order to "clear" the selection, while maintaining the previous selection feels like a good approach.
Engineering will most likely need to use the state hook within Combobox, since that will give them the most control of the combobox functionality. Some parts, like the event handling will be a little tricky. We're happy to help support the engineering team when they're building this.
If you want to chat more about this, feel free to schedu…