Galleria
vig-galleria ng-template[vigGalleriaItem] ng-template[vigGalleriaThumbnail] ng-template[vigGalleriaCaption]
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.
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).
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"]
| Part | Element | data-state |
|---|---|---|
root | role="region" . | — |
stage | aspect-galleria ), the tab panel of the thumbnails. | — |
image | <img> (without a vigGalleriaItem template). | — |
previous | — | |
next | — | |
fullscreen | fullscreen : opens the viewer. | — |
caption | — | |
counter | — | |
status | — | |
thumbnails | role="tablist" strip, scrolling with snap. | — |
thumbnail | active, inactive | |
viewer | <dialog> ; its ::backdrop is --color-backdrop-strong . | open, closed |
viewer-toolbar | — | |
viewer-zoom-level | — | |
viewer-status | — | |
viewer-zoom-out | aria-disabled when fitted). | — |
viewer-zoom-in | aria-disabled at 400%). | — |
viewer-rotate | — | |
viewer-reset | — | |
viewer-close | — | |
viewer-stage | fitted, zoomed | |
viewer-image | — | |
viewer-caption | — | |
viewer-previous | — | |
viewer-next | — |
| Attribute | Meaning |
|---|---|
data-opening | <dialog> ) while its entrance transition plays; removed once it settles (2s at most). Style the entrance with data-opening: utilities. |
data-closing | 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-galleriaA 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.
<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
| Name | Type | Default | Description |
|---|---|---|---|
activeIndex | number | 0 | Two-way: the zero-based position of the image shown (an item index,
unlike a carousel's |
circular | boolean | false | Previous on the first image goes to the last, and next on the last to the first. |
fullscreen | boolean | false | Offers the full-screen viewer (button on the image). |
items | readonly T[] | [] | The images, in order. |
labels | Partial<GalleriaLabels> | — | Texts (i18n) over the locale defaults. |
open | boolean | false | Two-way: whether the full-screen viewer is open. |
thumbnails | boolean | true | Shows the thumbnail strip. Default |
| Name | Payload | Description |
|---|---|---|
activeIndexChange | number | Two-way: the zero-based position of the image shown (an item index,
unlike a carousel's |
openChange | boolean | Two-way: whether the full-screen viewer is open. |
| Signature | Description |
|---|---|
step(direction: -1 | 1): void | Shows the previous (-1) or next (1) image, wrapping when |
GalleriaItem
ng-template[vigGalleriaItem]Replaces the main image (e.g. a <picture> or a video poster). Bind the
items to vigGalleriaItemOf to type let-item.
| Name | Type | Default | Description |
|---|---|---|---|
vigGalleriaItemOf | readonly T[] | null | undefined | undefined | Type-only: the galleria's items, so |
GalleriaThumbnail
ng-template[vigGalleriaThumbnail]Replaces the content of each thumbnail tab. Bind the items to vigGalleriaThumbnailOf.
| Name | Type | Default | Description |
|---|---|---|---|
vigGalleriaThumbnailOf | readonly T[] | null | undefined | undefined | Type-only: the galleria's items, so |
GalleriaCaption
ng-template[vigGalleriaCaption]The caption of the active item, under the main image and in the
full-screen viewer. Bind the items to vigGalleriaCaptionOf.
| Name | Type | Default | Description |
|---|---|---|---|
vigGalleriaCaptionOf | readonly T[] | null | undefined | undefined | Type-only: the galleria's items, so |