GalleryImage
Gallery image that handles variant changes with crossfade. Shows old image + shimmer while new image loads, then crossfades. Framework-agnostic: uses a render prop to let you provide any image component.

Usage
import { GalleryImage, ImageSkeleton, LoadingImage } from "@desk/ui/components/gallery";Best practices
In Next.js pass a
childrenrender prop wrappingnext/imageand thread itssrc+classNamethrough — the default renderer is a plain<img>that skips Next optimization.When you omit
children,altis required (a dev warning fires otherwise); passalt=""to mark the image decorative.altis ignored once a render prop supplies its own image.Drive variant switches by changing
src— that triggers the built-in crossfade + shimmer; don't unmount/remountGalleryImageper variant or you lose the transition.Position
GalleryImageinside arelativecontainer with fixed dimensions — the surfaces areabsolute inset-0, so an unsized parent collapses to zero height.
Props
GalleryImage
| Prop | Type | Default | Description |
|---|---|---|---|
| alt | string | Alt text for the built-in | |
| children | (props: ImageRenderProps) => ReactNode | Render function that receives props to spread onto your image component.
Must pass | |
| className | string | Additional className for the image | |
| src | string | Current image source URL; changing it triggers the crossfade transition. |
ImageSkeleton
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string |
LoadingImage
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactElement<{ onLoad?: () => void; className?: string; }, string | import("react").JSXElementConstructor<any>> | The image element to render (e.g., next/image, native img) | |
| className | string | Additional className for the image |