Image
<x-wirekit::image> renders a user-content image as a semantic <figure> with
required alt text, native lazy loading, and an optional caption. Set a ratio
and it reserves the space before the image loads, so the page never shifts
as images arrive (CLS-safe). The component only renders — pass a ready URL
(a signed, ACL-protected download URL works unchanged).
For a profile picture use <x-wirekit::avatar>; for a
before/after slider use <x-wirekit::image-compare>.
Usage
CLS-safe ratio box
Set ratio so the box is sized from the start and the layout never jumps. fit
controls how the image fills the box — cover (fill + crop) or contain
(letterbox):
Square, contain
Decorative image
An image that adds no information passes an empty alt so screen readers skip
it. Only use this when the image is truly decorative:
Props
| Prop | Type | Default | Description |
|---|---|---|---|
src |
string|null |
null |
Image URL (ready-to-render; signed URLs work). |
alt |
string |
'' |
Accessible name. Required for content images; empty for decorative. |
caption |
string|null |
null |
Optional visible caption, rendered as a <figcaption>. |
ratio |
string|null |
null |
Intrinsic aspect-ratio (16/9, 4/3, 1/1, …) — reserves space before load. |
fit |
string |
'cover' |
cover (fill + crop) or contain (letterbox). Applies only with a ratio. |
rounded |
bool |
false |
Round the corners with the --radius-wk-md token. |
loading |
string |
'lazy' |
Native loading — use eager for an above-the-fold hero. |
scope |
string|null |
null |
Scoped personalization key. |
Accessibility
altis required for content images. Describe what the image shows. Passalt=""only for a purely decorative image, so assistive tech skips it instead of announcing the file.- The image is wrapped in a
<figure>; acaptionrenders as its<figcaption>. - With a
ratio, the reserved box prevents layout shift, which also keeps focus order stable as images load.
Keyboard Interaction
This component is purely presentational and does not respond to keyboard input.