lara-light-indigo

Image

Displays an image with preview and tranformation options. For multiple image, see Galleria.

Basic
Image
Preview and Zoom
Image
Thumbnail
Image
Import via Module

import { Image } from 'primereact/image';
 
Import via CDN

<script src="https://unpkg.com/primereact/core/core.min.js"></script>
<script src="https://unpkg.com/primereact/image/image.min.js"></script>
 
Getting Started

Image is used as the native img element and supports all properties that the native element has.


<Image src="image1.png" alt="Image Text" />
 
Preview

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

Thumbnail

Allow different images or sizes for source and preview images using zoomSrc property.

Templating

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


<Image src="image1.png" template="Preview Content" alt="Image Text" />
 
Properties

Image passes any valid attribute to the underlying img element, additional attribute is the following.

NameTypeDefaultDescription
srcstringnullSpecifies the path to the image.
previewbooleanfalseControls the preview functionality.
zoomSrcstringnullZoomed image that may be different than "src" image.
downloadablebooleanfalseAdds a download button to the preview control menu.
imageStyleanynullInline style of the image element.
imageClassNamestringnullStyle class of the image element.
Events

Any valid event like click and mouseover are passed to the underlying input element. Events below are the additional ones related to the preview functionality.

NameParametersDescription
onShow-Triggered when the preview overlay is shown.
onHide-Triggered when the preview overlay is hidden.
onErrorevent: Browser eventTriggered when the image fails to load.
Styling

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

NameElement
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.
Accessibility

This section is under development. After the necessary tests and improvements are made, it will be shared with the users as soon as possible.

Dependencies

None.

Component Scale

Input Style

Ripple Effect

Free Themes

Built-in component themes created by the PrimeReact Theme Designer.

Bootstrap
Blue
Purple
Blue
Purple
Material Design
Indigo
Deep Purple
Indigo
Deep Purple
Material Design Compact
Indigo
Deep Purple
Indigo
Deep Purple
Tailwind
Tailwind Light
Fluent UI
Blue
PrimeOne Design - 2022 NEW
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
PrimeOne Design - 2021
Saga Blue
Saga Green
Saga Orange
Saga Purple
Vela Blue
Vela Green
Vela Orange
Vela Purple
Arya Blue
Arya Green
Arya Orange
Arya Purple
Premium Themes

Premium themes are only available exclusively for PrimeReact Theme Designer subscribers and therefore not included in PrimeReact core.

Soho Light
Soho Dark
Viva Light
Viva Dark
Mira
Nano

Legacy Free Themes

Nova
Nova Alt
Nova Accent
Luna Blue
Luna Green
Luna Amber
Luna Pink
Rhea

Premium Create-React-App Templates

Beautifully crafted premium create-react-app application templates by the PrimeTek design team.

Sakai
Atlantis
Freya
Ultima
Diamond
Sapphire
Serenity
Babylon
Avalon
Apollo
Roma