lara-light-indigo

Galleria

Galleria is a content gallery component.

Import via Module

import { Galleria } from 'primereact/galleria';
 
Import via CDN

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

Galleria requires a value as an array of objects and can either be used as a Controlled or Uncontrolled component.


<Galleria value={images} item={itemTemplate} thumbnail={thumbnailTemplate}></Galleria>
 

const itemTemplate = (item) => {
    // custom item content
}

const thumbnailTemplate = (item) => {
    // custom thumbnail content
}
 
Items per page

Number of items per page is defined using the numVisible property.


<Galleria value={images} item={itemTemplate} thumbnail={thumbnailTemplate}
    numVisible={5}></Galleria>
 
Responsive

For responsive design, numVisible can be defined using the responsiveOptions property that should be an array of objects whose breakpoint defines the max-width to apply the settings.


<Galleria value={images} item={itemTemplate} thumbnail={thumbnailTemplate}
    numVisible={5} responsiveOptions={responsiveOptions}></Galleria>
 

const responsiveOptions = [
    {
        breakpoint: '1024px',
        numVisible: 5
    },
    {
        breakpoint: '768px',
        numVisible: 3
    },
    {
        breakpoint: '560px',
        numVisible: 1
    }
];
 
Header and Footer

Custom content projection is available using the header and footer properties.


<Galleria value={images} item={itemTemplate} thumbnail={thumbnailTemplate}
    header={<h1>Header</h1>}></Galleria>

 
Controlled vs Uncontrolled

In controlled mode, activeIndex and onItemChange properties need to be defined to control the first visible item.


<Galleria value={images} item={itemTemplate} thumbnail={thumbnailTemplate}
    activeIndex={activeIndex} onItemChange={(e) => setActiveIndex(e.index)}></Galleria>
 
Uncontrolled

In uncontrolled mode, no additional properties are required. Initial item can be provided using the activeItemIndex property in uncontrolled mode however it is evaluated at initial rendering and ignored in further updates. If you programmatically need to update the first visible item index, prefer to use the component as controlled.


<Galleria value={images} item={itemTemplate} thumbnail={thumbnailTemplate}></Galleria>
 
Properties
NameTypeDefaultDescription
idstringnullUnique identifier of the element.
valuearraynullAn array of objects to display.
activeIndexnumber0Index of the first item.
headeranynullLabel of header.
footeranynullLabel of footer.
stylestringnullInline style of the component.
classNamestringnullStyle class of the component.
itemfunctionnullFunction that gets an item in the value and returns the content for preview item.
thumbnailfunctionnullFunction that gets an item in the value and returns the content for thumbnail item.
indicatorfunctionnullFunction that gets an item in the value and returns the content for indicator item.
captionfunctionnullFunction that gets an item in the value and returns the content for caption item.
circularbooleanfalseDefines if scrolling would be infinite.
autoPlaybooleanfalseItems are displayed with a slideshow in autoPlay mode.
transitionIntervalnumber4000Time in milliseconds to scroll items.
numVisiblenumber3Number of items per page.
responsiveOptionsanynullAn array of options for responsive design.
thumbnailsPositionstringbottomPosition of thumbnails. Valid values are "bottom", "top", "left" and "right".
indicatorsPositionstringbottomPosition of indicators. Valid values are "bottom", "top", "left" and "right".
verticalThumbnailViewPortHeightstring300pxHeight of the viewport in vertical thumbnail.
showItemNavigatorsbooleanfalseWhether to display navigation buttons in item container.
showThumbnailNavigatorsbooleantrueWhether to display navigation buttons in thumbnail container.
showThumbnailsbooleantrueWhether to display thumbnail container.
showIndicatorsbooleanfalseWhether to display indicator container.
showIndicatorsOnItembooleanfalseWhen enabled, indicator container is displayed on item container.
showItemNavigatorsOnHoverbooleanfalseWhether to display navigation buttons on item container's hover.
changeItemOnIndicatorHoverbooleanfalseWhen enabled, item is changed on indicator item's hover.
fullScreenbooleanfalseWhether to display the component on fullscreen.
baseZIndexnumber0Base zIndex value to use in layering.
transitionOptionsobjectnullThe properties of CSSTransition can be customized, except for "nodeRef" and "in" properties.
Events
NameParametersDescription
onItemChangeevent.index = index of the new item.Callback to invoke after changing item.
onShow-Callback to invoke when modal becomes visible.
onHide-Callback to invoke when modal becomes hidden.
Styling

Following is the list of structural style classes

NameElement
p-galleriaContainer element.
p-galleria-headerHeader section.
p-galleria-footerFooter section.
p-galleria-item-wrapperItem wrapper element. It contains item container and indicators.
p-galleria-item-containerContainer of the item wrapper. It contains navigation buttons, items and caption content.
p-galleria-indicatorsContainer of the indicators. It contains indicator items.
p-galleria-thumbnail-contentThumbnail content element.
p-galleria-thumbnail-containerContainer of the thumbnail content. It contains navigation buttons and thumbnail items.
p-galleria-captionContent of the item caption.
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