Skip to content

Commit

Permalink
add img example
Browse files Browse the repository at this point in the history
  • Loading branch information
mckelveygreg committed Dec 20, 2023
1 parent 11382ef commit 300a908
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/components/image.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,23 @@ referenced, so avoid using these. See [Can I
Email](https://www.caniemail.com/features/image-svg/) for more information.
:::

::: tip
To use local images during development, you can resolve the path with node.
Just remember, for production, you'll need to host the images somewhere and
reference them with a URL.

```jsx
import { Img } from 'jsx-email';

const baseUrl = import.meta.DEV ? import.meta.resolve('../assets/') : 'https://assets.example.com/';

const Email = () => {
return <Img src={`${baseUrl}cat.jpg`} alt="Cat" width="300" height="300" />;
};
```

:::

## Component Props

```ts
Expand Down

0 comments on commit 300a908

Please sign in to comment.