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.
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.
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.
Alignment and caption
Use the Frame component to control alignment and add captions to images. Below are examples of different alignments:
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.
Here's an example of a resized inline image within a paragraph.
Here's an example of a Markdown image within a paragraph.