Skip to content

Image ​

An Image is a visual element used to display content in various formats and states, supporting features like aspect ratios, placeholders, and responsive sizing.

Olive-bellied Sunbird flying from a flower to another at Kibale forest National Park.
NameValue
Props
aspectRatio
objectFit
objectPosition
position
View
Reading direction

Overview ​

When to use Image ​

Use the Image component to display visual content like photos or illustrations that enhance context and meaning of surrounding content.

Avoid using the Image component for small previews. Use the Thumbnail component instead.

Accessibility

Always provide meaningful alt text in Image to ensure accessibility.

About Image ​

Image includes the following elements.

Image ​

The Image component displays an image element if an image has been provided.

  • Use contextually relevant, neutral, high-quality images that accurately represent the subject and respect copyright requirements. Refer to the Style Guide to learn more about how to use images.

Placeholder icon ​

If the image is missing or loading, a placeholder icon on a background is displayed.

  • Customize the icon if needed.
  • Use an icon that provides clear context for the use of the Image.

Examples ​

Default ​

By default, the Image component displays an image in its original dimensions.

Olive-bellied Sunbird flying from a flower to another at Kibale forest National Park

Aspect ratio ​

The component supports aspect ratios to preserve layout structure.

An example image with aspect ratio 16:9

Placeholder ​

The placeholder serves two purposes:

  1. To display while the image is loading, improving the experience of those with slower connections.
  2. To display when an image is not provided.

Technical implementation ​

Vue usage ​

Props ​

Prop nameDescriptionTypeValuesDefault
srcThe source URL of the image.string-''
alt(required)Alternative text for the image.

Descriptive text must be provided unless the image is decorative or described elsewhere.
string-''
aspectRatioThe aspect ratio of the image.

Accepts one of the predefined aspect ratios.
ImageAspectRatio-null
objectPositionThe object-position of the image when cropping with an aspect ratio.

Accepts 'top', 'bottom', 'left', 'right', or 'center'.
typeof ObjectPositions[number]-'center'
objectFitSpecifies how the image should be resized to fit its container. Accepts 'fill', 'contain', 'cover', 'none', or 'scale-down'.typeof ObjectFitOptions[number]-'cover'
positionImage position on a pagestringleft, center, right''
widthThe width of the image in pixels.string|number-undefined
heightThe height of the image in pixels.string|number-undefined
loadingPriorityThe loading priority of the image.

Accepts 'lazy' or 'eager'.
stringlazy, eager'lazy'

Events ​

Event namePropertiesDescription
errorevent Event - The error event object.Emitted when an error occurs loading the image.