carbon-design-system / carbon

A design system built by IBM
https://www.carbondesignsystem.com
Apache License 2.0
7.76k stars 1.8k forks source link

Add a way to way to change the Select entry without reworking the SelectItem's selected option #7347

Closed guigueb closed 3 years ago

guigueb commented 3 years ago

Summary

I am asking for an enhancement and proposing a method to accomplish it.

The Select component has a defaultValue prop to choose a SelectItem when none has been selected. Changing the defaultValue once rendered and/or a selection has been made has no effect.

I am proposing that Select has a new prop - maybe selectedValue - that can be observed and when changed will change which SelectItem has the selected prop.

The same ability can be done by by the clients by traversing the SelectItem's and removing the selected prop from one and adding the selected prop to another, but the Carbon Select component would be cleaner to have a prop to do this.

Justification

Provide the business reasons for this request. In IBM Cognos products we panels where a Select component can drive objects on the screen. We allow this to be a two way street, so that objects on the screen can drive the state of the Select component.

Desired UX and success metrics

Usecase:

"Must have" functionality

No must have's that I can think of.

Specific timeline issues / requests

Everyone wants things now. We have a release in January - that would be good.

Available extra resources

When we are done converting our IBM products to use what Carbon currently has our efforts will be turned to enhancing Carbon.

guigueb commented 3 years ago

Close issue: what was I thinking Select accepts value prop which is what I want.