Back to React Email

Image

apps/docs/components/image.mdx

0.0.151.4 KB
Original Source

import Support from '/snippets/support.mdx'

Install

Install component from your command line.

<CodeGroup>
sh
npm install @react-email/components -E

# or get the individual package

npm install @react-email/img -E
sh
yarn add @react-email/components -E

# or get the individual package

yarn add @react-email/img -E
sh
pnpm add @react-email/components -E

# or get the individual package

pnpm add @react-email/img -E
</CodeGroup>

Getting started

Add the component to your email template. Include styles where needed.

jsx
import { Img } from "@react-email/components";

const Email = () => {
  return ;
};
<Tip> All email clients can display `.png`, `.gif`, and `.jpg` images. Unfortunately, `.svg` images are not well supported, regardless of how they're referenced, so avoid using these. See [Can I Email](https://www.caniemail.com/features/image-svg/) for more information. </Tip>

Props

<ResponseField name="alt" type="string"> Alternate description for an image </ResponseField> <ResponseField name="src" type="string"> The path to the image </ResponseField> <ResponseField name="width" type="string"> The width of an image in pixels </ResponseField> <ResponseField name="height" type="string"> The height of an image in pixels </ResponseField> <Support/>