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
Best practices
In Next.js pass a
childrenrender prop wrappingnext/imageand thread itssrc+classNamethrough - the default renderer is a plain<img>that skips Next optimisation.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.
