-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Dropdown: Customize selected label for single-select #852
Comments
I'm a little concerned about how far we're deviating from SUI core here. Since custom labels and custom dropdown items are not technically supported by SUI, they are working by chance really. There is no guarantee that an update shipped to SUI core today won't break this. That said, we've come this far and the ability to have a correctly rendered single select seems like a must. I suppose we can always PR any conflicts that may arise in SUI core CSS due to our special usage here. I think I am leaning toward number 3: "Add a different render* function for that?", but could you expound a bit on what you mean by number 1? |
@levithomason - just put up a PR with option 1, which is explained more clearly in the description of the PR. It's the approach that is supported by SUI-core so this should bring us more in line. |
Perfect, will follow up there 👍 |
Background
For the
Dropdown
component in SUI-core, dropdown options can have bothtext
andname
properties to distinguish b/w how the option should look within the dropdown menu and how it should look as the selected item (see a more in depth description here: #682 (comment))In my app I'm using a node for the
text
prop for each dropdown option to show more complex markup. Here's a rough example: http://codepen.io/jeffcarbs/pen/VmjmYo?editors=0010:For multi-select, you can now specify the
renderLabel
to customize how the selected items should be rendered.There's no such equivalent to be able to customize how/what the single-select should render the selected item. In that same example, when you select something it renders the same complex node:
I'd like it to show something else (e.g. just the simple text)
Question
Should/could we:
renderLabel
for both single/multiple? The third argument to that function is the dropdown props so one could dynamically do something different for single/multiple.render*
function for that?Thoughts?
The text was updated successfully, but these errors were encountered: