Skip to main content
Elastic UI
Elastic UI
Getting startedComponentsPatternsContentData visualization
EUI ChangelogGitHubFigma
  • Overview
  • Layout
  • Containers
  • Navigation
  • Display
    • Badge
    • Aspect ratio
    • Avatar
    • Beacon
    • Callout
    • Code
    • Comment list
    • Description list
    • Drag and drop
    • Empty prompt
    • Health
    • Icon
    • Image
    • List group
    • Loading
    • Progress
    • Skeleton
    • Stat
    • Text
    • Timeline
    • Title
    • Toast
    • Tooltip
    • Tour
  • Forms
  • Tabular content
  • Templates
  • Editors and syntax
  • EUI
  • Display
  • Icon

Icon

EuiIcon is a handy component for using our custom glyphs and logos. The

type prop accepts either an enumerated name from one of the sets below, a location to a custom SVG asset, or a React Element.

Component

Loading...

Accessibility recommendation

If possible, provide a descriptive title based on the icon use. If no title is provided, the icon is considered purely decorative, and it will default to aria-hidden=true.

Usage

Sizes

Use the size prop to automatically size your icons. Medium is the default, and will output a 16x16 icon.

Loading...

Colors

The default behavior of icons is to inherit from the text color. You can use the color prop to assign a custom color which accepts a named color from our palette or a validย 

CSS color data typeย which will be passed down through the inline-style fillย  property. We recommend relying on the EUI named color palette unless the custom color is initiated by the user (like as a graph color).

Two-tone icons, like our app style icons, will behave similarly to normal glyphs when provided a specific color by applying the color to all the shapes within. You can force the icon to match the parent's text color by passing color="inherit" to the icon.

Loading...

Glyphs

Glyphs are small, monochromatic icons that typically should always use the default size of size="m". They are named according to their appearance or the action they represent. For example, star, play, etc.

If you would like to contribute to our growing list of glyphs, you can follow these guidelines.

Loading...

Editor controls

Editor icons relate to the visual styling of elements and are commonly used within EuiButtonGroup components.

Loading...

Elastic logos

These logos are restricted in use to Elastic products or when referencing Elastic products. They are multi-color with some internal paths having a class of .euiIcon__fillNegative to handle flipping colors for dark mode. The only other colors most of them support are ghost and text which turn them into a solid shape.

Loading...

Apps

App logos are logos for Elastic Apps, and can contain multiple colors. Normally the Elastic Design team creates those icons. They are not meant to be used outside of Elastic, because they represent our apps. App logos are usually displayed at 32x32 or above and can contain multiple colors.

Loading...

Machine learning icons

Machine learning has some specific icons for job creation. Again, these are made for 32x32.

Loading...

Tokens

Tokens are most commonly used to visually signify field or code types. An EuiToken accepts any valid EuiIcon as its iconType property. However, icons designed specifically for use in the EuiToken are prefixed with "token" in their name and have pre-defined styles.

Loading...

Custom tokens

By default, an iconType with the token prefix (i.e. those listed above) will have predefined styles. However, any valid iconType can be passed and, in either case, the shape, size, color, and fill can be customized.

โœ„๐˜—
tsx code block:
โœ„๐˜—<EuiToken iconType="tokenStruct" size="xs" color="gray" />
โœ„๐˜—
tsx code block:
โœ„๐˜—<EuiToken iconType="tokenStruct" fill="none" />
โœ„๐˜—
tsx code block:
โœ„๐˜—<EuiToken iconType="tokenStruct" size="m" shape="circle" color="#b9f6c8" />
โœ„๐˜—
tsx code block:
โœ„๐˜—<EuiToken iconType="faceHappy" />
โœ„๐˜—
tsx code block:
โœ„๐˜—<EuiToken iconType="faceHappy" size="l" color="euiColorVis7" shape="rectangle" fill="dark" />

Custom SVGs

The type prop can accept a valid enum, string or React SVG Element. When using a custom SVG, please make sure it sits on a square canvas and preferably utilizes one of EUI's sizes (16x16 or 32x32).

When using custom SVGs for simple glyphs, remove all fill attributes on the SVG and utilize the CSS helpers if you have complex logos that need to work with theming.

Important considerations when importing SVGs as components

When importing an SVG as a component like import { ReactComponent as ReactLogo } from './logo.svg';, keep in mind that the component will not support the title prop. The title prop is designed to only work with our icons or SVGs imported as images or passed as a Data URL. So, if you're importing your SVG as a component, be sure to use anaria-label instead of a title prop to enhance accessibility and avoid potential issues.

Loading...

Props

EuiIcon

๐˜‚๐˜‚
โœ„๐˜—โœ„๐˜—
Prop
โ†ฆ
Description and type
โ†ฆ
Default value
โ†ต
Prop
type#
โ†ฆ
Description and type

Enum is any of the named icons listed in the docs, string is usually a URL to an SVG file, and elementType is any React SVG component

Type: IconType
โ†ฆ
Default value
Required
โ†ต
Prop
size#
โ†ฆ
Description and type

Note that every size other than original assumes the provided SVG sits on a square viewbox.

Type: "s" | "m" | "l" | "xl" | "xxl" | "original"
โ†ฆ
Default value
โ†ต
Prop
title#
โ†ฆ
Description and type

Descriptive title for naming the icon based on its use

Type: string
โ†ฆ
Default value
โ†ต
Prop
className#
โ†ฆ
Description and type
Type: string
โ†ฆ
Default value
โ†ต
Prop
css#
โ†ฆ
Description and type
Type: Interpolation<Theme>
โ†ฆ
Default value
โ†ต
Prop
color#
โ†ฆ
Description and type

One of EUI's color palette or a valid CSS color value https://developer.mozilla.org/en-US/docs/Web/CSS/color_value.
Note that coloring only works if your SVG is removed of fill attributes.

Type: string
โ†ฆ
Default value
โ†ต
Prop
aria-label#
โ†ฆ
Description and type

Defines a string value that labels the current element.
@see aria-labelledby.

Type: string
โ†ฆ
Default value
โ†ต
Prop
data-test-subj#
โ†ฆ
Description and type
Type: string
โ†ฆ
Default value
โ†ต
Prop
titleId#
โ†ฆ
Description and type

A unique identifier for the title element

Type: string
โ†ฆ
Default value
โ†ต
Prop
onIconLoad#
โ†ฆ
Description and type

Callback when the icon has been loaded & rendered

Type: () => void
โ†ฆ
Default value
โ†ต
Prop
ref#
โ†ฆ
Description and type

Allows getting a ref to the component instance.
Once the component unmounts, React will set ref.current to null
(or call the ref with null if you passed a callback ref).
@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}

Type: LegacyRef<unknown>
โ†ฆ
Default value
โ†ต
๐˜‚๐˜‚
Edit this page

Previous
Health
Next
Image
  • Component
  • Usage
    • Sizes
    • Colors
    • Glyphs
    • Editor controls
    • Elastic logos
    • Apps
    • Machine learning icons
    • Tokens
    • Custom tokens
    • Custom SVGs
  • Props
EUI is dual-licensed under Elastic License 2.0 and Server Side Public License, v 1 | Crafted with โค by Elastic