---
title: Image
description: The Image component renders an image for the Storefront API's
api_version: 2026-04
api_name: hydrogen
source_url:
  html: 'https://shopify.dev/docs/api/hydrogen/latest/components/media/image'
  md: 'https://shopify.dev/docs/api/hydrogen/latest/components/media/image.md'
---

# Image

The `Image` component renders an image for the Storefront API's [Image object](https://shopify.dev/api/storefront/reference/common-objects/image) by using the `data` prop. You can [customize this component](https://shopify.dev/api/hydrogen/components#customizing-hydrogen-components) using passthrough props.

Images default to being responsive automatically (`width: 100%, height: auto`), and expect an `aspectRatio` prop, which ensures your image doesn't create any layout shift. For fixed-size images, you can set `width` to an exact value, and a `srcSet` with 1x, 2x, and 3x DPI variants will automatically be generated for you.

#### Props

* **aspectRatio**

  **string**

  The aspect ratio of the image, in the format of `width/height`.

* **crop**

  **Crop**

  **Default: \`center\`**

  The crop position of the image.

* **data**

  **PartialDeep\<ImageType, {recurseIntoArrays: true}>**

  Data mapping to the [Storefront API `Image`](https://shopify.dev/docs/api/storefront/2026-04/objects/Image) object. Must be an Image object.

* **loader**

  **Loader**

  A function that returns a URL string for an image.

* **srcSetOptions**

  **SrcSetOptions**

  An optional prop you can use to change the default srcSet generation behaviour

### Crop

```ts
'center' | 'top' | 'bottom' | 'left' | 'right'
```

### Loader

* params

  ```ts
  LoaderParams
  ```

returns

```ts
string
```

### LoaderParams

* crop

  The URL param that controls the cropping region

  ```ts
  Crop
  ```

* height

  The URL param that controls height

  ```ts
  number
  ```

* src

  The base URL of the image

  ```ts
  string
  ```

* width

  The URL param that controls width

  ```ts
  number
  ```

### SrcSetOptions

* incrementSize

  The increment by which to increase for each size, in pixels

  ```ts
  number
  ```

* intervals

  The number of sizes to generate

  ```ts
  number
  ```

* placeholderWidth

  The size used for placeholder fallback images

  ```ts
  number
  ```

* startingWidth

  The smallest image size

  ```ts
  number
  ```

Examples

### Examples

* #### Example code

  ##### JavaScript

  ```jsx
  import {Image} from '@shopify/hydrogen';

  // An example query
  const IMAGE_QUERY = `#graphql
    query {
      product {
        featuredImage {
          altText
          url
          height
          width
        }
      }
    }
  `;

  export default function ProductImage({product}) {
    if (!product.featuredImage) {
      return null;
    }

    return (
      <Image
        data={product.featuredImage}
        sizes="(min-width: 45em) 50vw, 100vw"
        aspectRatio="4/5"
      />
    );
  }
  ```

  ##### TypeScript

  ```tsx
  import React from 'react';
  import {Image} from '@shopify/hydrogen';
  import type {Product} from '@shopify/hydrogen/storefront-api-types';

  // An example query
  const IMAGE_QUERY = `#graphql
    query {
      product {
        featuredImage {
          altText
          url
          height
          width
        }
      }
    }
  `;

  export default function ProductImage({product}: {product: Product}) {
    if (!product.featuredImage) {
      return null;
    }

    return (
      <Image
        data={product.featuredImage}
        sizes="(min-width: 45em) 50vw, 100vw"
        aspectRatio="4/5"
      />
    );
  }
  ```

***

## Related

[- MediaFile](https://shopify.dev/docs/api/hydrogen/2026-04/components/media/mediafile)

***
