Effects
JS behaviour
Image reveal
An image placeholder that resolves from pixel noise and blur into the loaded image — for AI generation or lazy images — with a progress state.
Real scenarios
The component as it is used in a product — not a specimen grid.
AI image generator
While the model works, pixel noise churns and gets finer with the progress; at 100% the noise dissolves outward and the image sharpens out of a blur.
Generating
Generation failed
0%
A lazy gallery
No progress here: each frame waits for its image and resolves the moment it has loaded. Press the button to let them arrive one after another.
Loading
Could not load the image
Loading
Could not load the image
Loading
Could not load the image
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| src · alt | string | null · '' | The image and its alt; the noise keeps going while src is empty. |
| progress | int|null | null | 0–100; below 100 the image stays hidden while the noise grows finer. Without it, it just waits for the load. |
| placeholder | string | null | A tiny blurred preview (LQIP); the aurora gradient otherwise. |
| ratio | string | '4 / 3' | Aspect ratio of the frame. |
| label · error-label | string | 'Loading' · … | Status text while waiting and when the image fails. |
Snippet
<x-nx::image-reveal :src="$result?->url" alt="فانوس دریایی در غروب"
:progress="$progress" ratio="16 / 9" label="در حال ساخت" wire:poll.500ms="tick" />
{{-- without Livewire --}}
<div x-data>
<x-nx::image-reveal id="art" alt="…" :progress="0" />
<button x-on:click="document.getElementById('art').dispatchEvent(new CustomEvent('nx-image-update', { detail: { progress: 100, src: url } }))">…</button>
</div>