šŸ“„ primereact/galleria

File: galleria.md | Updated: 11/15/2025

Source: https://primereact.org/galleria/

Introducing PrimeReact v11 Alpha 🄁Learn More

Galleria

Galleria is a content gallery component.

Import#


import { Galleria } from 'primereact/galleria';
         

Copy

Basic#


Galleria requires a value as a collection of images, item template for the higher resolution image and thumbnail template to display as a thumbnail.

Description for Image 1

Description for Image 1

Description for Image 2

Description for Image 3

Description for Image 4

Description for Image 5

Description for Image 6

Description for Image 7

Description for Image 8

Description for Image 9

Description for Image 10

Description for Image 11

Description for Image 12

Description for Image 13

Description for Image 14

Description for Image 15

<Galleria value={images} responsiveOptions={responsiveOptions} numVisible={5} style={{ maxWidth: '640px' }} 
    item={itemTemplate} thumbnail={thumbnailTemplate} />
         

Copy

Controlled#


Galleria can be controlled programmatically using a binding to activeIndex along with onItemChange event to update the active index.

Description for Image 1

Description for Image 1

Description for Image 2

Description for Image 3

Description for Image 4

Description for Image 5

Description for Image 6

Description for Image 7

Description for Image 8

Description for Image 9

Description for Image 10

Description for Image 11

Description for Image 12

Description for Image 13

Description for Image 14

Description for Image 15

<div>
    <Button icon="pi pi-minus" onClick={prev} className="p-button-secondary" />
    <Button icon="pi pi-plus" onClick={next} className="p-button-secondary ml-2" />
</div>

<Galleria value={images} activeIndex={activeIndex} onItemChange={(e) => setActiveIndex(e.index)} responsiveOptions={responsiveOptions} numVisible={5}
    item={itemTemplate} thumbnail={thumbnailTemplate} style={{ maxWidth: '640px' }} />
         

Copy

Indicator#


Indicators allow quick navigation between the items.

Click Event#

Indicators are displayed at the bottom by enabling showIndicators property and interacted with the click event by default.

Description for Image 1

<Galleria value={images} style={{ maxWidth: '640px' }} showThumbnails={false} showIndicators item={itemTemplate} />
         

Copy

Hover Event#

Indicators can be activated on hover instead of click if changeItemOnIndicatorHover is added.

Description for Image 1

<Galleria value={images} style={{ maxWidth: '640px' }} showThumbnails={false} showIndicators item={itemTemplate} />
         

Copy

Position#

Indicators can be placed at four different sides using the indicatorsPosition property. In addition, enabling showIndicatorsOnItem moves the indicators inside the image section.

Bottom

Top

Left

Right

Inside

Description for Image 1

<Galleria value={images} style={{ maxWidth: '640px' }} showThumbnails={false} showIndicators 
    showIndicatorsOnItem={inside} indicatorsPosition={position} item={itemTemplate} />
         

Copy

Template#

Indicator content can be customized with the indicator property that takes an index as a parameter and expects content.

Description for Image 1

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10

  • 11

  • 12

  • 13

  • 14

  • 15

    <Galleria value={images} style={{ maxWidth: '640px' }} className="custom-indicator-galleria" showThumbnails={false} showIndicators changeItemOnIndicatorHover showIndicatorsOnItem indicatorsPosition="left" item={itemTemplate} indicator={indicatorTemplate} />

Copy

Thumbnail#


Thumbnails represent a smaller version of the actual content.

Bottom

Top

Left

Right

Description for Image 1

Description for Image 1

Description for Image 2

Description for Image 3

Description for Image 4

Description for Image 5

Description for Image 6

Description for Image 7

Description for Image 8

Description for Image 9

Description for Image 10

Description for Image 11

Description for Image 12

Description for Image 13

Description for Image 14

Description for Image 15

<Galleria style={{ maxWidth: '640px' }} value={images} responsiveOptions={responsiveOptions} numVisible={5} 
    item={itemTemplate} thumbnailsPosition={position} thumbnail={thumbnailTemplate} />
         

Copy

Responsive#


Galleria responsiveness is defined with the responsiveOptions property.

Description for Image 1

Description for Image 1

Description for Image 2

Description for Image 3

Description for Image 4

Description for Image 5

Description for Image 6

Description for Image 7

Description for Image 8

Description for Image 9

Description for Image 10

Description for Image 11

Description for Image 12

Description for Image 13

Description for Image 14

Description for Image 15

<Galleria value={images} responsiveOptions={responsiveOptions} numVisible={7} circular style={{ maxWidth: '800px' }}
    item={itemTemplate} thumbnail={thumbnailTemplate} />
         

Copy

Full Screen#


In fullscreen mode content covers the whole page over a modal layer.

With Thumbnails#

Full screen mode is enabled by adding fullScreen property and the ref of the Galleria needs to be defined so that show method can be called from a target like a button.

Show

<Galleria ref={galleria} value={images} responsiveOptions={responsiveOptions} numVisible={9} style={{ maxWidth: '50%' }} 
    circular fullScreen showItemNavigators item={itemTemplate} thumbnail={thumbnailTemplate} />

<Button label="Show" icon="pi pi-external-link" onClick={() => galleria.current.show()} />
         

Copy

Without Thumbnails#

Thumbnails can also be hidden in full screen mode.

Show

<Galleria ref={galleria} value={images} numVisible={9} style={{ maxWidth: '50%' }} 
    circular fullScreen showItemNavigators showThumbnails={false} item={itemTemplate} thumbnail={thumbnailTemplate} />

<Button label="Show" icon="pi pi-external-link" onClick={() => galleria.current.show()} />
         

Copy

Custom Content#

Using activeIndex, Galleria is displayed with a specific initial image.

Description for Image 1

Description for Image 2

Description for Image 3

Description for Image 4

Description for Image 5

Description for Image 6

Description for Image 7

Description for Image 8

Description for Image 9

Description for Image 10

Description for Image 11

Description for Image 12

Description for Image 13

Description for Image 14

Description for Image 15

<Galleria ref={galleria} value={images} numVisible={7} style={{ maxWidth: '850px' }}
    activeIndex={activeIndex} onItemChange={(e) => setActiveIndex(e.index)}
    circular fullScreen showItemNavigators showThumbnails={false} item={itemTemplate} thumbnail={thumbnailTemplate} />

<div className="grid" style={{ maxWidth: '400px' }}>
    {
        images && images.map((image, index) => {
            let imgEl = <img src={image.thumbnailImageSrc} onClick={
                () => {setActiveIndex(index); galleria.current.show()}
            } />
            return (
                <div className="col-3" key={index}>
                    {imgEl}
                </div>
            )
        })
    }
</div>
         

Copy

Navigator#


Navigators are used to move back and forth between the images.

With Thumbnails#

Add showItemNavigators to display navigator elements and the left and right side.

Description for Image 1

Description for Image 1

Description for Image 2

Description for Image 3

Description for Image 4

Description for Image 5

Description for Image 6

Description for Image 7

Description for Image 8

Description for Image 9

Description for Image 10

Description for Image 11

Description for Image 12

Description for Image 13

Description for Image 14

Description for Image 15

<Galleria value={images} responsiveOptions={responsiveOptions} numVisible={5} circular style={{ maxWidth: '640px' }} showItemNavigators 
    item={itemTemplate} thumbnail={thumbnailTemplate} />
         

Copy

Without Thumbnails#

Simple example with indicators only.

Description for Image 1

<Galleria value={images} numVisible={5} circular style={{ maxWidth: '640px' }} showItemNavigators 
    showThumbnails={false} item={itemTemplate} thumbnail={thumbnailTemplate} />
         

Copy

Display on Hover#

Navigators are displayed on hover only if showItemNavigatorsOnHover is enabled.

Description for Image 1

Description for Image 1

Description for Image 2

Description for Image 3

Description for Image 4

Description for Image 5

Description for Image 6

Description for Image 7

Description for Image 8

Description for Image 9

Description for Image 10

Description for Image 11

Description for Image 12

Description for Image 13

Description for Image 14

Description for Image 15

<Galleria value={images} responsiveOptions={responsiveOptions} numVisible={5} circular style={{ maxWidth: '640px' }} 
    showItemNavigators showItemNavigatorsOnHover item={itemTemplate} thumbnail={thumbnailTemplate} />
         

Copy

With Indicators#

Navigators and Indicators can be combined as well.

Description for Image 1

<Galleria value={images} numVisible={5} circular style={{ maxWidth: '640px' }} 
    showItemNavigators showItemNavigatorsOnHover showIndicators
    showThumbnails={false} item={itemTemplate} thumbnail={thumbnailTemplate} />
         

Copy

AutoPlay#


A slideshow implementation is defined by adding circular and autoPlay properties.

Description for Image 1

Description for Image 1

Description for Image 2

Description for Image 3

Description for Image 4

Description for Image 5

Description for Image 6

Description for Image 7

Description for Image 8

Description for Image 9

Description for Image 10

Description for Image 11

Description for Image 12

Description for Image 13

Description for Image 14

Description for Image 15

<Galleria value={images} responsiveOptions={responsiveOptions} numVisible={5} style={{ maxWidth: '640px' }} 
    item={itemTemplate} thumbnail={thumbnailTemplate} circular autoPlay transitionInterval={2000} />
         

Copy

Caption#


Description of an image is specified with the caption property that takes the displayed object and returns content.

Description for Image 1

Title 1

Description for Image 1

Description for Image 1

Description for Image 2

Description for Image 3

Description for Image 4

Description for Image 5

Description for Image 6

Description for Image 7

Description for Image 8

Description for Image 9

Description for Image 10

Description for Image 11

Description for Image 12

Description for Image 13

Description for Image 14

Description for Image 15

<Galleria value={images} responsiveOptions={responsiveOptions} numVisible={5} 
    item={itemTemplate} thumbnail={thumbnailTemplate} caption={caption} style={{ maxWidth: '640px' }} />
         

Copy

Advanced#


Advanced Galleria implementation with a custom UI.

Description for Image 1

Ā Ā 1/15Title 1Description for Image 1Ā 

<Galleria ref={galleria} value={images} activeIndex={activeIndex} onItemChange={onItemChange}
    showThumbnails={showThumbnails} showItemNavigators showItemNavigatorsOnHover
    numVisible={5} circular autoPlay transitionInterval={3000} responsiveOptions={responsiveOptions}
    item={itemTemplate} thumbnail={thumbnailTemplate} footer={footer}
    style={{ maxWidth: '640px' }} className={galleriaClassName} />
         

Copy

Accessibility#


Screen Reader

Galleria uses region role and since any attribute is passed to the main container element, attributes such as aria-label and aria-roledescription can be used as well. The slides container has aria-live attribute set as "polite" if galleria is not in autoplay mode, otherwise "off" would be the value in autoplay.

A slide has a group role with an aria-label that refers to the aria.slideNumber property of the locale API. Similarly aria.slide is used as the aria-roledescription of the item. Inactive slides are hidden from the readers with aria-hidden.

Next and Previous navigators are button elements with aria-label attributes referring to the aria.nextPageLabel and aria.firstPageLabel properties of the locale API by default respectively, you may still use your own aria roles and attributes as any valid attribute is passed to the button elements implicitly by using nextButtonProps and prevButtonProps.

Quick navigation elements and thumnbails follow the tab pattern. They are placed inside an element with a tablist role whereas each item has a tab role with aria-selected and aria-controls attributes. The aria-label attribute of a quick navigation item refers to the aria.pageLabel of the locale API. Current page is marked with aria-current.

In full screen mode, modal element uses dialog role with aria-modal enabled. The close button retrieves aria-label from the aria.close property of the locale API.

Next/Prev Keyboard Support

| Key | Function | | --- | --- | | tab | Moves focus through interactive elements in the carousel. | | enter | Activates navigation. | | space | Activates navigation. |

Quick Navigation Keyboard Support

| Key | Function | | --- | --- | | tab | Moves focus through the active slide link. | | enter | Activates the focused slide link. | | space | Activates the focused slide link. | | right arrow | Moves focus to the next slide link. | | left arrow | Moves focus to the previous slide link. | | home | Moves focus to the first slide link. | | end | Moves focus to the last slide link. |

  • Import

  • Basic

  • Controlled

  • Indicator

    • Click Event

    • Hover Event

    • Position

    • Template

  • Thumbnail

  • Responsive

  • Full Screen

    • With Thumbnails

    • Without Thumbnails

    • Custom Content

  • Navigator

    • With Thumbnails

    • Without Thumbnails

    • Display on Hover

    • With Indicators

  • AutoPlay

  • Caption

  • Advanced

  • Accessibility

PrimeReact 10.9.7 by PrimeTek