Galleria

A main image with a strip of thumbnails, captions and an optional full-screen viewer.

  • vig-galleria
  • ng-template[vigGalleriaItem]
  • ng-template[vigGalleriaThumbnail]
  • ng-template[vigGalleriaCaption]
Import
import { Galleria, GalleriaItem, GalleriaThumbnail, GalleriaCaption } from '@vigdx/ui/galleria';

Basic, full screen

items are GalleriaImage s ( src , alt , optional thumbnailSrc , previewSrc , srcset , width , height , caption ) or your own objects extending it. [(activeIndex)] is two-way: it is an item index (a carousel's page counts pages of slides instead). fullscreen adds a button that opens the same viewer as vig-image , where the arrow keys step through the images.

Harbour at dawn, Aegean region
Harbour at dawn
1 of 8

Active index: 0

Templates and circular

vigGalleriaCaption , vigGalleriaThumbnail and vigGalleriaItem (the main image) receive the item typed from …Of . circular wraps previous and next around. The stage shape is the --aspect-galleria token (4 / 3).

Harbour at dawn, Aegean region
Harbour at dawn · Aegean
1 of 8

Styling hooks

Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="galleria"][data-part="root"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.

Scope: [data-scope="galleria"]

Galleria styling hooks
Part Element data-state
root The host, a named role="region" . —
stage The main image area ( aspect-galleria ), the tab panel of the thumbnails. —
image The main <img> (without a vigGalleriaItem template). —
previous Previous image button over the stage. —
next Next image button over the stage. —
fullscreen With fullscreen : opens the viewer. —
caption The row with the caption and counter. —
counter The position, e.g. "3 of 8". —
status Visually hidden polite status announcing a new image (inside the viewer while open). —
thumbnails The role="tablist" strip, scrolling with snap. —
thumbnail One thumbnail tab; the selected one has a border (Highlight in forced colors), focus an outline. active, inactive
viewer The full-screen native modal <dialog> ; its ::backdrop is --color-backdrop-strong . open, closed
viewer-toolbar The row of viewer controls. —
viewer-zoom-level The visible zoom percentage (hidden from screen readers). —
viewer-status Visually hidden polite status with the zoom level, debounced for wheel and pinch. —
viewer-zoom-out Zoom out button ( aria-disabled when fitted). —
viewer-zoom-in Zoom in button ( aria-disabled at 400%). —
viewer-rotate Rotate a quarter turn clockwise (R; Shift+R back). —
viewer-reset Back to fitted and upright (0). —
viewer-close Close button; takes focus when the viewer opens. —
viewer-stage The area around the image: pinch, wheel and drag; a press on it closes. fitted, zoomed
viewer-image The image, transformed by zoom, rotation and panning. —
viewer-caption The caption under the image (hidden when empty). —
viewer-previous Previous image button in the viewer. —
viewer-next Next image button in the viewer. —
Galleria data attributes
Attribute Meaning
data-opening On the overlay element (panel or <dialog> ) while its entrance transition plays; removed once it settles (2s at most). Style the entrance with data-opening: utilities.
data-closing On the overlay element while its exit transition plays, before it closes; removed once it settles (2s at most). Style the closed look with data-closing: utilities.

Accessibility

  • The thumbnails are an APG tab list with automatic activation, and the main image is its tab panel: one tab stop, ←→ (mirrored in right-to-left pages), Home and End move and show; each tab is named by its image's alt.
  • The selected thumbnail has a border (Highlight in forced colors) and focus an outline (CanvasText there), so both show at once; inactive ones are only dimmed as decoration. Thumbnails load lazily and scroll in their own strip with scroll snap.
  • A polite status announces the position and alt text ("3 of 8: Crater lake") once quick steps come to rest, from inside the viewer while it is open. With a single image the stage is a named group rather than a tab panel.
  • Previous and next buttons step through the images; when one becomes disabled while focused, focus moves to the other. The full-screen viewer follows the image viewer's keyboard and focus rules, with the arrow keys stepping through images while not zoomed.

API

Galleria

vig-galleria component

A main image with a strip of thumbnails. The thumbnails are an APG tab list with automatic activation (arrow keys mirrored in RTL, Home, End; one tab stop) controlling the main image, its tab panel; previous/next buttons step through the images. fullscreen opens the active image in the same viewer as vig-image (zoom, rotate, arrow keys between images).

items are GalleriaImages, or your own objects extending it; the vigGalleriaItem, vigGalleriaThumbnail and vigGalleriaCaption templates receive them typed.

Example :
<vig-galleria [items]="photos" [(activeIndex)]="current" fullscreen />

While the fullscreen viewer plays its entrance or exit transition, its <dialog> carries data-opening or data-closing (stable hooks for styling and for waiting in tests; see the theming guide). data-opening data-closing

Galleria props
Name Type Default Description
activeIndex model number0

Two-way: the zero-based position of the image shown (an item index, unlike a carousel's page, which counts pages of several slides).

circularbooleanfalse

Previous on the first image goes to the last, and next on the last to the first.

fullscreenbooleanfalse

Offers the full-screen viewer (button on the image).

itemsreadonly T[][]

The images, in order.

labelsPartial<GalleriaLabels>—

Texts (i18n) over the locale defaults.

open model booleanfalse

Two-way: whether the full-screen viewer is open.

thumbnailsbooleantrue

Shows the thumbnail strip. Default true.

GalleriaItem

ng-template[vigGalleriaItem] directive

Replaces the main image (e.g. a <picture> or a video poster). Bind the items to vigGalleriaItemOf to type let-item.

GalleriaItem props
Name Type Default Description
vigGalleriaItemOfreadonly T[] | null | undefinedundefined

Type-only: the galleria's items, so let-item is typed. Not read at runtime.

GalleriaThumbnail

ng-template[vigGalleriaThumbnail] directive

Replaces the content of each thumbnail tab. Bind the items to vigGalleriaThumbnailOf.

GalleriaThumbnail props
Name Type Default Description
vigGalleriaThumbnailOfreadonly T[] | null | undefinedundefined

Type-only: the galleria's items, so let-item is typed. Not read at runtime.

GalleriaCaption

ng-template[vigGalleriaCaption] directive

The caption of the active item, under the main image and in the full-screen viewer. Bind the items to vigGalleriaCaptionOf.

GalleriaCaption props
Name Type Default Description
vigGalleriaCaptionOfreadonly T[] | null | undefinedundefined

Type-only: the galleria's items, so let-item is typed. Not read at runtime.

Are you sure?