# Image Viewer > A thumbnail that opens the image in a zoomable lightbox. Source: https://shellui.dev/docs/v0.4/components/advanced/image-viewer `ImageViewer` is **new in v0.4**. It renders a thumbnail button; clicking it opens the full image over the page, with zoom controls. ## Installation ```bash shellui add image-viewer ``` ## Usage ### Basic Size the thumbnail with `Class`. The image covers it. ```razor @code { private const string Image = "data:image/svg+xml;utf8,"; } ``` ### Gallery Each viewer opens its own image. Pass a small `ThumbnailSrc` to keep a grid light and load the full `Src` only in the lightbox. ```razor
@foreach (var (sky, hill) in palettes) { }
@code { private readonly (string Sky, string Hill)[] palettes = [ ("93c5fd", "059669"), ("fda4af", "7c3aed"), ("fde68a", "ea580c"), ]; private static string Image(string sky, string hill) => $"data:image/svg+xml;utf8,"; } ``` ## Keyboard | Key | Action | |-----|--------| | `Esc` | Close | | `+` or `=` | Zoom in | | `-` | Zoom out | | `0` | Reset zoom | Zoom runs from 50% to 400% in steps of 25%. Clicking the backdrop also closes the viewer. ## API Reference | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | `Src` | `string` | `""` | The full-size image | | `ThumbnailSrc` | `string?` | `null` | Image for the thumbnail; defaults to `Src` | | `Alt` | `string` | `""` | Alternative text | | `Class` | `string?` | `null` | Classes for the thumbnail button, such as its size | | `ImageClass` | `string?` | `null` | Classes for the thumbnail image | ## Accessibility - The thumbnail is a button labelled "View" plus the `Alt` text - The lightbox is `role="dialog"` with `aria-modal="true"` and takes focus when it opens - The zoom and close buttons have labels