---
title: Image
---

import LibraryInfo from '@theme/LibraryInfo'
import { Feedback, TokensTable, PropsTable } from '../../src/components'
import { DefaultImage as WebDocs } from 'docs/@telus-uds/components-web'
import AvailableOnWebOnly from '../../partials/_platform-considerations-web-only.mdx'

# Image

<LibraryInfo packageType="Web Component" />

```jsx live
<Image src={'/universal-design-system/img/pigs-allium-lo.png'} alt="Guinea pig" width={300} />
```

## Introduction

A basic `img` wrapper.

[Follow the appropriate instructions](importing-components) to add this component in to your app.

## Guidance

- We recommend not to resize or crop images in the browser.
- The width and height should be the same ratio as the natural width and height of the image.
- Image optimization should be done BEFORE rendering.
- You can use the `contentful API` to request an image of a certain size.
- `rounded="circle"` requires a square image `(width == height)` in order to generate a perfect circle.
- Non-square images will give a warning and will appear oval shaped.
- When using the image symbol in the Sketch file, replace the image in the overrides with and image with the same aspect ratio.
- Pass `'lazy'` via the `loading` prop to make the image
  [lazy-loading](https://developer.mozilla.org/en-US/docs/Web/Performance/Lazy_loading#images_and_iframes)

### Accessibility

Always provide an `alt` attribute for images with a short description of the image. You can use an empty string (`""`) if the image is purely decorative and conveys no information.

### Platform considerations

<AvailableOnWebOnly />

## Props

<PropsTable web={WebDocs} />

## Tokens

<TokensTable web={WebDocs} component="Image" />

## Variants

### Rounded

The image can either have rounded corners or be converted to a circle using the rounded prop.

```jsx live
<>
  <Image rounded="corners" src={testImage} alt="Closeup of allium flower" width={300} />
  <Image rounded="circle" src={testImage} alt="Closeup of allium flower" width={300} />
</>
```

## Feedback

<Feedback component="Image" />
