Skip to main content
Elastic UI
Elastic UI
ComponentsPatternsContentData visualization
EUI ChangelogGitHubFigma
  • Guidelines
    • Getting started
    • Accessibility
    • Writing
    • Testing
  • Theming
    • Theme provider
    • Color mode
    • High contrast mode
    • Borders
    • Breakpoints
    • Colors
    • Sizing
    • Typography
  • Templates
    • Page template
    • Sitewide search
  • Layout
    • Accordion
    • Bottom bar
    • Flex
    • Flyout
    • Header
    • Horizontal rule
    • Modal
    • Page components
    • Page header
    • Panel
    • Popover
    • Resizable container
    • Spacer
  • Navigation
    • Breadcrumbs
    • Buttons
    • Collapsible nav
    • Context menu
    • Facet
    • Key pad menu
    • Link
    • Pagination
    • Side nav
    • Steps
    • Tabs
    • Tree view
  • Display
    • Aspect ratio
    • Avatar
    • Badge
    • Callout
    • Card
    • Comment list
    • Description list
    • Drag and drop
    • Empty prompt
    • Health
    • Icons
    • Image
    • List group
    • Loading
    • Progress
    • Skeleton
    • Stat
    • Text
    • Timeline
    • Title
    • Toast
    • Tooltip
    • Tour
  • Forms
    • Form controls
    • Form layouts
    • Form validation
    • Text controls
    • Numeric controls
    • Selection controls
    • Search and filter controls
    • Date and time controls
    • Other controls
  • Tabular content
    • Tables
    • Data grid
  • Editors & Syntax
    • Code
    • Markdown
  • Utilities
    • Accessibility
    • Auto sizer
    • Beacon
    • Color palettes
    • Copy
    • CSS utility classes
    • Delay
    • Error boundary
    • Focus trap
    • Highlight and mark
    • HTML ID generator
    • I18n
    • Inner text
    • Mutation observer
    • Outside click detector
    • Overlay mask
    • Portal
    • Pretty duration
    • Provider
    • Resize observer
    • Scroll
    • Text diff
    • Text truncation
    • Window events
  • EUI
  • Display
  • Image

Image

Use EuiImage when you need to place a static image into a page with an optional caption.

Writing meaningful image alt text

This page has several examples of alt text written to aid screen reader users, as well as several examples of when not to include alt text. When an image is decorative, or if the image is adequately described by surrounding text, it is better to pass an empty

"" string instead.

When an image is not already sufficiently described, the alt text passed should help non-visual users understand the purpose of the image within the context of the overall page. See

WebAIM for a more detailed guide to writing effective alt text.

Loading...

Click an image for a fullscreen version

Apply the allowFullScreen prop to make the image clickable and show a fullscreen version. Note that the second image also passes fullScreenIconColor="dark" to change icon color to better contrast against the light background of that image.

Loading...

Images can be sized

Images can be sized by passing the size prop a value of s / m / l / xl / original / fullWidth / number / string. This size sets the maximum length of the longest edge of the image, whether that is height or width, and scales it. Only the provided sizing values will also increase the size of a smaller image.

Loading...

Supporting SVG images

If you are using an SVG source within EuiImage, the SVG image may not show up! While this is surprising to the user, if your image doesn't have a width or viewbox set, it is behaving in accordance with the SVG spec.

In order to work with an SVG image that lacks a defined size, you'll want to set a size prop. If you are using the allowFullScreen prop as well, you will also want to add a width prop.

Loading...

Float images within text

When using EuiImage within EuiText it is often useful to apply floats. Almost always you'll want to pair the float prop usage, with a margin prop usage to give space around your image. Margins, when used in combo with floats, will adjust depending upon the position of the float.

Be careful with floats

Floats should only be used on images within large bodies of text. Specifically, we only suggest using them with EuiText which comes automatically clears floats.

Loading...

Props

EuiImage

Extends HTMLAttributes
𐘂𐘂
✄𐘗✄𐘗
Prop
↦
Description and type
↦
Default value
↵
Prop
alt#
↦
Description and type

Alt text should describe the image to aid screen reader users. See
https://webaim.org/techniques/alttext/ for a guide on writing
effective alt text.

If no meaningful description exists, or if the image is adequately
described by the surrounding text, pass an empty string.

Type: string
↦
Default value
Required
↵
Prop
className#
↦
Description and type
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
css#
↦
Description and type
Type: Interpolation<Theme>
↦
Default value
↵
Prop
src#
↦
Description and type

Requires either src or url but defaults to using src if both are provided

Type: string
↦
Default value
↵
Prop
url#
↦
Description and type
Type: string
↦
Default value
↵
Prop
caption#
↦
Description and type

Provides a visible caption to the image

Type: ReactNode
↦
Default value
↵
Prop
size#
↦
Description and type

Accepts s / m / l / xl / original / fullWidth / or a CSS size of number or string.
fullWidth will set the figure to stretch to 100% of its container.
string and number types will max both the width or height, whichever is greater.

Type: string | number
↦
Default value
original
↵
Prop
float#
↦
Description and type

Float the image to the left or right. Useful in large text blocks.

Type: "left" | "right"
↦
Default value
↵
Prop
margin#
↦
Description and type

Margin around the image.

Type: "s" | "m" | "l" | "xl"
↦
Default value
↵
Prop
hasShadow#
↦
Description and type

When set to true (default) will apply a slight shadow to the image

Type: boolean
↦
Default value
↵
Prop
allowFullScreen#
↦
Description and type

When set to true will make the image clickable to a larger version

Type: boolean
↦
Default value
↵
Prop
onFullScreen#
↦
Description and type

Callback when the image is clicked and allowFullScreen is true

Type: (isFullScreen: boolean) => void
↦
Default value
↵
Prop
fullScreenIconColor#
↦
Description and type

Changes the color of the icon that floats above the image when it can be clicked to fullscreen.
The default value of light is fine unless your image has a white background, in which case you should change it to dark.

Type: EuiImageButtonIconColor
↦
Default value
↵
Prop
wrapperProps#
↦
Description and type

Props to add to the wrapping figure element

Type: CommonProps & HTMLAttributes<HTMLDivElement>
↦
Default value
↵
𐘂𐘂
Edit this page

Previous
Icons
Next
List group
  • Click an image for a fullscreen version
  • Images can be sized
  • Supporting SVG images
  • Float images within text
  • Props
EUI is dual-licensed under Elastic License 2.0 and Server Side Public License, v 1 | Crafted with ❤ by Elastic