Displays an image with preview and tranformation options.

import { ImageModule } from 'primeng/image';

Image is used as the native img element and supports all properties that the native element has. For multiple image, see Galleria.


<p-image src="" alt="Image" width="250"></p-image>

Preview mode displays a modal layer when the image is clicked that provides transformation options such as rotating and zooming.


<p-image src="" alt="Image" width="250" [preview]="true"></p-image>

An eye icon is displayed by default when the image is hovered in preview mode. Use the indicator template for custom content.


<p-image src="" [preview]="true" alt="Image" width="250">
    <ng-template pTemplate="indicator">
        <i class="pi pi-check"></i>

In case that you want to show different image on preview, you can set previewImageSrc attribute. It could come handy when wanted to use smaller image version at first and bigger one on preview.


<p-image src="" previewImageSrc="" alt="Image" width="250" [preview]="true"></p-image>

Following is the list of structural style classes, for theming classes visit theming page.

p-imageContainer element.
p-image-preview-containerContainer element with preview enabled.
p-image-preview-indicatorMask layer over the image when hovered.
p-image-preview-iconIcon of the preview indicator.
p-image-maskPreview overlay container.
p-image-toolbarTransformation options container.
p-image-actionAn element inside the toolbar.
p-image-previewImage element inside the preview overlay.

Screen Reader

The preview button is a native button element with an aria-label that refers to the aria.zoomImage property of the locale API by default.

When preview is active, dialog role with aria-modal is applied to the overlay image container.

Button controls use aria.rotateRight, aria.rotateLeft, aria.zoomIn, aria.zoomOut and aria.close from the locale API as aria-label.

ButtonBar Keyboard Support

When preview is activated, close button receives the initial focus.

tabMoves focus through button bar.
enterActivates the button.
spaceActivates the button.
escCloses the image preview.