Next Chapter Begins 🚀Read the full story
styledMedia

Gallery

Gallery is a component to display a collection of images in a gallery.

preview

Usage#

import { Gallery } from '@primereact/ui/gallery';
<Gallery.Root>
    <Gallery.Backdrop />
    <Gallery.Prev></Gallery.Prev>
    <Gallery.Next></Gallery.Next>
    <Gallery.Header>
        <Gallery.RotateLeft></Gallery.RotateLeft>
        <Gallery.RotateRight></Gallery.RotateRight>
        <Gallery.ZoomIn></Gallery.ZoomIn>
        <Gallery.ZoomOut></Gallery.ZoomOut>
        <Gallery.FlipX></Gallery.FlipX>
        <Gallery.FlipY></Gallery.FlipY>
        <Gallery.Download></Gallery.Download>
        <Gallery.FullScreen></Gallery.FullScreen>
    </Gallery.Header>
    <Gallery.Content>
        <Gallery.Item></Gallery.Item>
    </Gallery.Content>
    <Gallery.Footer>
        <Gallery.Thumbnail>
            <Gallery.ThumbnailContent>
                <Gallery.ThumbnailItem></Gallery.ThumbnailItem>
            </Gallery.ThumbnailContent>
        </Gallery.Thumbnail>
    </Gallery.Footer>
</Gallery.Root>

Examples#

Basic#

Displays a collection of images with a lightbox viewer.

basic-demo

Toolbar#

Add a Gallery.Header with action sub-components like RotateLeft, ZoomIn, Download, and FullScreen to expose image controls.

toolbar-demo

Thumbnails#

Add a Gallery.Footer with Gallery.Thumbnail to render a thumbnail strip for quick navigation.

thumbnails-demo

Single#

Click on the image to open it in a fullscreen dialog without thumbnails or navigation buttons.

image
single-demo

Grid#

image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
grid-demo

Sub-Components#

See Primitive API for GalleryRoot, GalleryContent, GalleryItem, GalleryPrev, GalleryNext, GalleryHeader, GalleryFooter, GalleryBackdrop, GalleryThumbnail, GalleryThumbnailContent, GalleryThumbnailItem, and action component documentation.

Hooks#

See Headless API for useGallery hook documentation.

Accessibility#

See Gallery Primitive for WAI-ARIA compliance details and keyboard support.