You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[EuiComboBox] Allow custom render of selected items #2358
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.
Both Maps and Graph use this icon selection technique.
Reacted by Nathan Reese, Joe Reuter, Colm O'Shea and Tilman
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.
I think we'll want to add a custom rendering function to this - naively reusing the existing renderOption in our docs renders as
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.
👋 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.
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.
Activity
cchaos commentedon Sep 20, 2019
cc @flash1293 @nreese
cchaos commentedon 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.
chandlerprall commentedon Sep 25, 2019
I think we'll want to add a custom rendering function to this - naively reusing the existing
renderOptionin our docs renders asThere is another level of effort here as the rendered content will need to be processed (e.g. with
EuiInnerText) to pass it in as theiconOnClickAriaLabel.[-]EuiComboBox to allow custom render of selected items[/-][+][EuiComboBox] Allow custom render of selected items[/+]github-actions commentedon Mar 19, 2021
👋 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 commentedon Mar 19, 2021
Bump - this is still valid.
1 remaining item
nreese commentedon Sep 15, 2021
Bump - this is still valid.
tilman commentedon Oct 15, 2021
This issue is now open for 2 years. Is there any work planned or workaround avalaible?
cchaos commentedon Feb 11, 2022
Closing this old issue in favor of #5628 which contains working screenshots and a workaround until we can solve it internally.
JasonStoltz commentedon Jan 17, 2023
Reopening as this is more representative of the work we'd like to do, rather than #5628
cee-chen commentedon 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.prependandoption.appendAPI (see docs).The largest reason for this is because
EuiComboBoxis eventually going to adoptEuiSelectableunder the hood (see #2841) for accessibility. The closer we can get toEuiSelectable'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/appendnodes 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 newrenderPillAPI rather than bogartingrenderOption. This is so consumers currently usingrenderOptiondon't suddenly and unexpectedly see a change in their pill rendering without them changing any props.