Skip to content

Combobox: Option to render html element inside selected item #953

Answered by SiTaggart
kalaindrek asked this question in Ideas
Discussion options

You must be logged in to vote

Hi @kalaindrek

There is a constraint that we are adhering to with the Combobox, and that is it's an HTML input element that stores the value. As such we are limited to what an HTML input element can display as a value, it can only display strings.

You can get the first part fairly easily by updating the itemToString method you supply

itemToString={(item: any) => (item ? `${String(item.label)} | String(item.value)` : null)}

Where you concat the item and value together into a single string to display.

We just can't support displaying an icon (or anything other than a string) as part of the displayed value.

Hope that answers your question.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by SiTaggart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants