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.
Overview
Lazy by default; set loading="eager" for images visible on first paint.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
src | string | — | Image address. |
alt | string | — | Describe the image; leave empty (alt="") for decoration. |
ratio | string | — | 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. |
srcset | string | — | Candidate images for different screen densities and widths (as on <img>). |
sizes | string | — | Layout width hints for srcset (as on <img>). |
width | string | — | Intrinsic width in pixels; with height it reserves space when no ratio is set. |
height | string | — | Intrinsic height in pixels. |
zoomable | boolean | — | 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
| Event | React / Svelte prop | Description |
|---|---|---|
pm-load | onPmLoad | The image loaded. |
pm-error | onPmError | The image failed to load. |
Slots
| Slot | Description |
|---|---|
fallback | Shown when the image cannot load (default: the alt text). |