Skip to content

[EuiComboBox] Allow rendering icon for the chosen option  #5628

Closed

Description

@mbondyra

This is the use case we have for Lens. We generate the Icon list, but the selected Item doesn't show the preview of the icon.

Screenshot 2022-02-11 at 09 48 54

Could we somehow enable it, either by adding a custom renderSelectedOption prop or specifically passing icon inside selectedOptions?

Activity

  1. elizabetdev commented on Feb 11, 2022

    @elizabetdev
    Contributor

    Hi @mbondyra,

    A pattern that we've been using in our Elastic products is to show the selected icon in a prepend.

    Screenshot 2022-02-11 at 12 07 17

    You can take a look at the code on the following CodeSandbox: https://codesandbox.io/s/icon-selection-with-euicombobox-qe384.

    I think this solution works but is not ideal and obvious for EUI consumers. So not sure this feature request is something that we want to allow in EuiComboBox or to provide a search functionality in EuiSuperSelect. @chandlerprall and @thompsongl might know better what's the future plan for these components.

    Also because this is a pattern that our consumers normally search we should consider adding it to our documentation.

  2. mbondyra commented on Feb 11, 2022

    @mbondyra
    ContributorAuthor

    Oh wow, I think it will work great for our case! @MichaelMarcialis, could you confirm we are ok with the icon in prepend? In that case I'll add it to the PR. Thank you @miukimiu!

  3. MichaelMarcialis commented on Feb 11, 2022

    @MichaelMarcialis
    Contributor

    Thanks @miukimiu and @mbondyra! I just now saw that Maps uses this pattern for their icon selector. I'm good with adopting this approach in Lens as well.

  4. cchaos commented on Feb 11, 2022

    @cchaos
    Contributor

    This is also a duplicate of #2358, but since the screenshot in that issue is broken and this one at least indicates a current workaround, I'll close the old one. I do think we should consider building in a custom render option to the component at some point, so we should keep this open. Probably capture it during the EuiSelectable conversion and to match EuiSuperSelect.

  5. github-actions commented on Aug 10, 2022

    @github-actions

    👋 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.

  6. added
    stale-issue
    on Aug 10, 2022
  7. MichaelMarcialis commented on Aug 15, 2022

    @MichaelMarcialis
    Contributor

    Still valid

  8. removed
    stale-issue
    on Aug 15, 2022
  9. JasonStoltz commented on Jan 17, 2023

    @JasonStoltz
    Contributor

    Closing in favor of #2358

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions