Skip to content
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

[EuiComboBox] Allow custom render of selected items #2358

Closed
cchaos opened this issue Sep 20, 2019 · 11 comments · Fixed by #6953
Closed

[EuiComboBox] Allow custom render of selected items #2358

cchaos opened this issue Sep 20, 2019 · 11 comments · Fixed by #6953

Comments

@cchaos
Copy link
Contributor

cchaos commented Sep 20, 2019

Right now the combobox allows you to pass a custom render for the options in the list but you can't replicate that render in the input itself when an option is selected.

Example: Icon list

It would be very beneficial to also show the icon in the input.

Screenshot 2022-02-11 at 09 48 54

Both Maps and Graph use this icon selection technique.

@cchaos
Copy link
Contributor Author

cchaos commented Sep 20, 2019

cc @flash1293 @nreese

@cchaos
Copy link
Contributor Author

cchaos commented Sep 24, 2019

We discussed this, and the best way to handle it is to use the same render method as provided for the options (if possible, have to look at the code) or just provide another custom render method for the selected option.

@cchaos cchaos self-assigned this Sep 24, 2019
@chandlerprall
Copy link
Contributor

I think we'll want to add a custom rendering function to this - naively reusing the existing renderOption in our docs renders as

renderOption reuse

There is another level of effort here as the rendered content will need to be processed (e.g. with EuiInnerText) to pass it in as the iconOnClickAriaLabel.

@snide snide removed the :urgent: label Oct 29, 2019
@cchaos cchaos removed their assignment Mar 18, 2020
@cchaos cchaos changed the title EuiComboBox to allow custom render of selected items [EuiComboBox] Allow custom render of selected items Sep 20, 2020
@github-actions
Copy link

👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

@flash1293
Copy link
Contributor

Bump - this is still valid.

@github-actions
Copy link

👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

@nreese
Copy link
Contributor

nreese commented Sep 15, 2021

Bump - this is still valid.

@tilman
Copy link

tilman commented Oct 15, 2021

This issue is now open for 2 years. Is there any work planned or workaround avalaible?

@cchaos
Copy link
Contributor Author

cchaos commented Feb 11, 2022

Closing this old issue in favor of #5628 which contains working screenshots and a workaround until we can solve it internally.

@cchaos cchaos closed this as completed Feb 11, 2022
@JasonStoltz
Copy link
Member

Reopening as this is more representative of the work we'd like to do, rather than #5628

@JasonStoltz JasonStoltz reopened this Jan 17, 2023
@cee-chen
Copy link
Member

cee-chen commented Jul 19, 2023

An update on the approach taken for this issue. Based on the requested use-cases, we've decided to resolve this request (made by @shahzad31 and other Elastic teams) via copying EuiSelectable's option.prepend and option.append API (see docs).

The largest reason for this is because EuiComboBox is eventually going to adopt EuiSelectable under the hood (see #2841) for accessibility. The closer we can get to EuiSelectable's existing API, the easier that migration will be. Additionally, adopting existing APIs and patterns leads to a more consistent developer experience and is generally preferable over introducing one-offs where possible.

All the mentioned Kibana use cases have primarily been around adding icon rendering, which prepend/append nodes should easily solve. If in the future, consumers truly need a totally custom render method for EuiComboBox's pills, we can revisit that choice at that point (in a new issue). However, I want to add my 2c that if that does happen, we should likely prefer to add a new renderPill API rather than bogarting renderOption. This is so consumers currently using renderOption don't suddenly and unexpectedly see a change in their pill rendering without them changing any props.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants