Variations GridPRO
Four generated variations land one by one; picking one grows it into a single large image.
Code
1 file · 362 lines of TypeScriptPRO
Variations Grid is part of Pro
Get its source, the one-paste agent prompt and all 113 components, for a one-time $99.
Motion notes
- Each tile shimmers on its own phase and resolves from a soft blur when its job finishes, so parallel results read as independent arrivals.
- The tile and the large view share a layoutId, so the picked image grows out of its exact spot on a layout spring and flies back when closed.
- The other tiles recede with scale, blur and dimming instead of disappearing, so you keep your place in the set.
- Hover or focus a tile for Upscale and Vary. Escape returns to the grid. With reduced motion the views cross-fade in place.
Usage
Example
<ImageVariations
variations={jobs.map((job) => ({ id: job.id, src: job.url, pending: !job.done }))}
onUpscale={upscale}
onVary={vary}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| variations | Variation[] | — | { id, src, alt?, pending?, imageStyle? }. Up to four, laid out 2 × 2. |
| selected | string | null | — | Controlled selection. null shows the grid. |
| defaultSelected | string | null | null | Starting selection when uncontrolled. |
| onSelectedChange | (id: string | null) => void | — | Called when a tile opens or the large view closes. |
| onUpscale | (id: string) => void | — | Upscale action for a variation. |
| onVary | (id: string) => void | — | Vary action for a variation. |
| label | string | "Variations" | Accessible name for the group. |
| className | string | — | Size it here; the default is w-72 at 3:4. |

