Image Viewer for Angular
Introduction
Section titled “Introduction”Shows photos, scans, and screenshots inline or in a gallery lightbox (a modal dialog): zoom by wheel, pinch, buttons, and keys; pan by drag and arrow keys; rotate; fit and actual size; previous and next with a thumbnail strip; and a crop mode with aspect ratio presets that produces a canvas and a Blob. Every image needs alt text, and image URLs are limited to safe schemes.
- Zoom every wayWheel, pinch, buttons, and + / - keys, around the pointer; fit and actual size with 0 and 1.
- Pan and rotateDrag or arrow keys to pan a zoomed image; R rotates in 90 degree steps.
- Gallery or lightboxInline viewer or a modal lightbox that restores focus, with a thumbnail strip and "2 of 5".
- Crop to a BlobAspect ratio presets, a crop area you move and resize by pointer or keyboard, and a canvas plus Blob out.
- Safe by defaultAlt text required; only https, blob, raster data, and same-origin image URLs; CSP-safe transforms.
Behavior, design tokens, and limitations are described on the Image Viewer page; this page covers the Angular API.
Live example
Section titled “Live example”import { Component } from '@angular/core';import type { ImageViewerCropDetail, ImageViewerImage } from '@absoluteui/components/image-viewer';import { AuiImageViewer } from '@absoluteui/angular/image-viewer';
@Component({ selector: 'app-photo-crop', imports: [AuiImageViewer], template: `<aui-image-viewer label="Profile photo" [images]="images" [croppable]="true" (cropped)="onCrop($event)"></aui-image-viewer>`,})export class PhotoCropComponent { readonly images: ImageViewerImage[] = [{ src: '/images/people-ada.png', alt: 'Ada Lovelace smiling' }]; size = ''; onCrop(detail: ImageViewerCropDetail): void { this.size = `${String(detail.rect.width)} x ${String(detail.rect.height)}`; }}Install and start
Section titled “Install and start”npm install @absoluteui/angular @absoluteui/components @absoluteui/core @absoluteui/themeSetup with provideAbsoluteUI() is covered in Getting started. Styles are included with the component.
import { AuiImageViewer } from '@absoluteui/angular/image-viewer';Defaults for every instance: provideAbsoluteUIConfig({ components: { imageViewer: { ... } } }) (see Configuration).
API reference
Section titled “API reference”<aui-image-viewer>
Section titled “<aui-image-viewer>”Class AuiImageViewer; template reference #ref="auiImageViewer".
Server rendering: Renders on the server; the browser re-creates it after hydration.
Inputs
Section titled “Inputs”| Input | Type | Default | Description |
|---|---|---|---|
label |
string |
Required. Accessible name of the viewer (region or dialog). | |
images |
readonly ImageViewerImage[] |
Required. One or more images { src, alt, decorative?, caption?, thumbnail?, width?, height?, downloadName? }. | |
mode |
ImageViewerMode |
'inline' |
inline renders into the host; lightbox renders a modal dialog opened with open(). |
index |
number |
'0' |
Shown image. |
loop |
boolean |
false |
Previous and next wrap around. |
croppable |
boolean |
false |
Show the Crop tool. |
aspectRatios |
readonly ImageViewerAspectRatio[] |
'Free, 1:1, 4:3, 16:9, 3:2' |
Crop presets { label, value: width / height | null }. |
cropType |
ImageViewerCropType |
'image/png' |
Blob type of the crop output. |
cropQuality |
number |
Quality from 0 to 1 for JPEG and WebP output. | |
crossOrigin |
"anonymous" | "use-credentials" | null |
null |
CORS mode of the image request; needed to crop cross-origin images. |
wheelZoom |
"auto" | "ctrl" | "always" |
'auto' |
When the wheel zooms: auto is Ctrl (or a pinch gesture) inline and always in the lightbox. |
icons |
Partial<ImageViewerIcons> |
Tool and error icons. | |
zoomStep |
number |
'1.25' |
Zoom factor of one step, 1.05 to 4. |
minZoom |
number |
'0.1' |
Smallest zoom, 0.01 to 1 (fit may go lower for very large images). |
maxZoom |
number |
'8' |
Largest zoom, 1 to 32. |
showThumbnails |
boolean |
true |
Show the thumbnail strip for two or more images. |
locale |
string |
'en-US' |
Locale of the counter, zoom level, and messages. |
Outputs
Section titled “Outputs”| Output | Payload | Description |
|---|---|---|
(changed) |
ImageViewerChangeDetail |
The shown image changed: { index, image }. Re-emits aui-change. |
(zoomed) |
ImageViewerZoomDetail |
The zoom changed: { zoom, fit }. Re-emits aui-zoom. |
(rotated) |
ImageViewerRotateDetail |
The image was rotated: { rotation, index }. Re-emits aui-rotate. |
(cropped) |
ImageViewerCropDetail |
A crop was applied: { blob, canvas, rect, rotation, index, image }. Re-emits aui-crop. |
(failed) |
ImageViewerErrorDetail |
An image failed to load, or a crop was refused (tainted canvas): { index, image, reason, message }. Re-emits aui-error. |
(opened) |
ImageViewerOpenDetail |
Lightbox opened: { index }. Re-emits aui-open. |
(closed) |
ImageViewerOpenDetail |
Lightbox closed: { index }. Re-emits aui-close. |
Methods
Section titled “Methods”Call them through a viewChild query or a template reference.
| Method | Description |
|---|---|
open(index?: number | undefined): void |
Lightbox: open the dialog (optionally at an image). Inline: show that image. |
close(): void |
Lightbox: close and restore focus. |
show(index: number): void |
Show an image (clamped), fitted and unrotated. |
next(): void |
Next image. |
previous(): void |
Previous image. |
zoomIn(): void |
Zoom in by one step. |
zoomOut(): void |
Zoom out by one step. |
setZoom(zoom: number): void |
Set the zoom, clamped to the zoom range. |
fit(): void |
Fit the image to the view. |
actualSize(): void |
Zoom to 100%. |
rotate(degrees?: number | undefined): void |
Rotate by a multiple of 90 degrees (default 90, clockwise). |
startCrop(aspect?: number | null | undefined): void |
Enter crop mode with an aspect ratio (default: the first preset). |
cancelCrop(): void |
Leave crop mode without output. |
crop(): Promise<ImageViewerCropDetail> | undefined |
Crop to the crop rectangle; resolves with the canvas and Blob and emits aui-crop. |
Accessibility and performance
Section titled “Accessibility and performance”Pattern: Inline: a labelled region with a toolbar (WAI-ARIA APG Toolbar), a focusable image stage, and thumbnail buttons with aria-current. Lightbox: the same content in a modal dialog (APG Dialog) that restores focus when it closes.
The Angular component renders the framework-neutral component, so its keyboard support, roles, WCAG 2.2 criteria, budgets, and import cost apply unchanged: see Image Viewer: Accessibility and performance.
(c) 2026 Kasadara Technology Solutions Pvt Ltd. AbsoluteUI is free to use under the AbsoluteUI Free Use License; it is not open source.