Skip to content

[EuiIcon] Would it be possible to have a rasterized version of the icons? #9839

Description

@dej611

Problem Statement

Currently icons are svg images wrapped by a EuiIcon component which hides completely both icon svg file (behind icon name) and its loading state - there's an onIconLoad but the raw svg is not actually provided as argument.
Also, rasterized version can be safer to use within a canvas (Elastic Charts has to use DOM rendering for elements/components who use icons) or in some tools like Monaco who prefer rasterized versions over svgs.

Right now in Kibana Workflow to define a new step icon it needs to find the right svg inner path of the icon, load it async AND there's little piece of code to generate a rastered version of it as data URL.

Proposed Solution

I would like to discuss the possibility to provide a rasterized version of the icons (perhaps a png sprite?) with the EUI bundle.

Use Case

  • Icons in canvas charts native
  • Monaco autocomplete/inline rendering

Value / Impact

I think the main value would be the reduction of adhoc solutions all around Kibana, as everybody is probably reinventing the wheel to rasterize icons.

Urgency

No particular urgency, but wanted to start a discussion about it at least.

Do alternatives or workarounds exist?

There are few workarounds, but they bring either some maintanance cost AND are really not that solid.

Related code or customizations

See https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-workflows-ui/src/components/step_icons/icon_to_data_url.ts for the workflow editor part

Activity

  1. weronikaolejniczak commented on Jul 23, 2026

    @weronikaolejniczak
    Contributor

    cc @elastic/eui-icons

  2. MichaelMarcialis commented on Jul 27, 2026

    @MichaelMarcialis
    Contributor

    Hey, @dej611! I'm personally not opposed to offering a consistent way to provide a rasterized version of the EUI icons, if that's something that's needed. However, I'm not entirely sure I understand the reasoning for it. You mention that it's safer/better for Elastic Charts and Monaco. Why is that? Is it needed for lazy loading? Some other reason? Also, we'd likely need to consider scaling concerns, if this is something we want to offer, as a rasterized image won't scale up well like a vector image will.

  3. dej611 commented on Jul 27, 2026

    @dej611
    ContributorAuthor

    Why is that? Is it needed for lazy loading? Some other reason? Also, we'd likely need to consider scaling concerns, if this is something we want to offer, as a rasterized image won't scale up well like a vector image will.

    I think even raw SVG could be fine. A rasterized version could be generated from it as long as its a pure SVG path, resolving the scaling concerns I think.
    The current problem is that the EuiIcon callback provided for loading is not suitable for a range of use cases so a direct way to access to the image underneath would be easier.
    I know right now there's a hacky way to do it, as we are already using it, but it would be nicer to have a proper/cleaner way to await import(svg/png file)

  4. MichaelMarcialis commented on Jul 27, 2026

    @MichaelMarcialis
    Contributor

    @weronikaolejniczak, @mgadewoll: Did ya'll want to comment on the technical feasibility of this ask?

  5. weronikaolejniczak commented on Jul 27, 2026

    @weronikaolejniczak
    Contributor

    @dej611 @MichaelMarcialis this is high effort and has to be discussed within my team but we could do something similar to @elastic/eui-illustrations (i.e. @elastic/eui-icons). A separate npm package that returns different formats: React components, SVGs, PNGs with different dimensions etc. This could be then supplied to our EuiIcon from @elastic/eui for rendering but could be used independently if needed. Low effort: we could bundle svgs... This definitely needs a spike.

  6. added a commit that references this issue on Aug 6, 2026
    0061f6e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions