Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Display

Image <pm-image>

Image with a fixed ratio (no layout shift), a placeholder while it loads, a fallback when it fails, and optional click-to-zoom.

Full screen
Photo unavailable

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/icon'; import '@prismora/elements/image'; import { registerIcons } from '@prismora/elements/icon'; import { imageOff } from '@prismora/icons'; registerIcons([imageOff]); </script> <pm-image src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 90'%3E%3Cdefs%3E%3ClinearGradient id='g' x2='1' y2='1'%3E%3Cstop stop-color='%237c5cff'/%3E%3Cstop offset='1' stop-color='%23ff7ab6'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='160' height='90' fill='url(%23g)'/%3E%3Ccircle cx='118' cy='30' r='14' fill='%23fff' opacity='.85'/%3E%3Cpath d='M0 90l45-48 30 30 22-18 63 36z' fill='%23fff' opacity='.35'/%3E%3C/svg%3E" alt="Abstract mountains at sunset" ratio="16/9" zoomable></pm-image> <pm-image src="data:image/png;base64,AAAA" alt="Photo unavailable" ratio="16/9"> <span slot="fallback" class="pm-cluster"> <pm-icon name="image-off"></pm-icon> Photo unavailable </span> </pm-image>

Overview

Lazy by default; set loading="eager" for images visible on first paint.

Attributes

AttributeTypeDefaultDescription
srcstring—Image address.
altstring—Describe the image; leave empty (alt="") for decoration.
ratiostring—Width / height, e.g. "16/9", "1/1", "4/3". Without it the image keeps its own ratio.
fit'cover' | 'contain'—cover (default: fill and crop) or contain (show everything).
loading'lazy' | 'eager'—lazy (default) or eager.
srcsetstring—Candidate images for different screen densities and widths (as on <img>).
sizesstring—Layout width hints for srcset (as on <img>).
widthstring—Intrinsic width in pixels; with height it reserves space when no ratio is set.
heightstring—Intrinsic height in pixels.
zoomableboolean—Click or press Enter to view the image full screen.

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Events

EventReact / Svelte propDescription
pm-loadonPmLoadThe image loaded.
pm-erroronPmErrorThe image failed to load.

Slots

SlotDescription
fallbackShown when the image cannot load (default: the alt text).