Image

Prose UI converts your images into NextJs images with all their benefits, like prevention of layout shift.

Use simple Markdown syntax if you don't need to resize, align, or add a caption on it.

Local image with markdown syntax
![Abstract art](/img/demo-image.png)

Abstract art

Image location

Images are retrieved from the public folder of your project by default, but this can be configured by passing the imageDir option when initializing the Remark plugins.

Images with external URLs

External images are converted into simple img tags because the dimensions of the image are not known in advance.

External image
![Photo of Saturn from Cassini orbiter](https://upload.wikimedia.org/wikipedia/commons/c/c7/Saturn_during_Equinox.jpg)

Photo of Saturn from Cassini orbiter

Image dimensions

To set image dimensions, use the width and height properties on the Image component. The values for width and height are in pixels.

If you set only the width, Prose UI will calculate the height automatically to maintain the image's proportions. The same applies if you set only the height.

The example below sets the width of the image to 400 pixels. The height will be automatically calculated to preserve the image's aspect ratio.

Set the width of an image
<Image width={400} src="/img/demo-image-03.png" alt="Abstract art"/>
Abstract art

Alignment and caption

Use the Frame component to control alignment and add captions to images. Below are examples of different alignments:

<Frame align="left" caption="Left aligned image">
   <Image width={200} src="/img/demo-image-01.png" alt="Abstract art"/>
</Frame>
<Frame align="center" caption="Center aligned image">
   <Image width={200} src="/img/demo-image-01.png" alt="Abstract art"/>
</Frame>
<Frame align="right" caption="Right aligned image">
   <Image width={200} src="/img/demo-image-03.png" alt="Abstract art"/>
</Frame>
Abstract art
Left aligned image
Abstract art
Center aligned image
Abstract art
Right aligned image

Inline images

By default, images added using Markdown syntax or the Image component are inline and will appear inside a paragraph tag unless wrapped in a Frame.

Inline image, resized
Here's an example <Image src="/img/demo-inline-image.svg" width={100} alt="Abstract art" /> of a resized inline image within a paragraph.

Here's an example Abstract art of a resized inline image within a paragraph.

Inline image with Markdown syntax
Here's an example ![Alt text](/img/demo-inline-image.svg) of a Markdown image within a paragraph.

Here's an example Alt text of a Markdown image within a paragraph.

Created by Valdemaras, designed by Domas. Source code available on GitHub.