Thinking UI

Generation GalleryPRO

A masonry grid of past generations that morphs into a lightbox and back.

Code

1 file · 287 lines of TypeScriptPRO

Generation Gallery is part of Pro

Get its source, the one-paste agent prompt and all 113 components, for a one-time $99.

Motion notes

  • Tiles cascade in on a staggered spring, rising out of a soft blur, so the grid reads as arriving in order rather than popping in at once.
  • Opening is one shared-layout morph: the tile grows into the lightbox at its own aspect ratio, so the image never stretches, and shrinks back into its slot on close.
  • The tile lifts on hover and reveals its prompt. The returning tile rides above the fading backdrop, so it never slips behind it.
  • Escape and the close button dismiss, and focus moves to the close button and back to the tile. With reduced motion the lightbox simply cross-fades.

Usage

Example
<ImageGallery
    items={generations.map((g) => ({
      id: g.id,
      src: g.url,
      prompt: g.prompt,
      ratio: g.width / g.height,
      meta: `Seed ${g.seed}`,
    }))}
  />

Props

PropTypeDefaultDescription
itemsGalleryItem[]—{ id, src, prompt, alt?, ratio?, position?, zoom?, filter?, meta? }. ratio is width ÷ height.
columnsnumber3Masonry columns, filled shortest first.
openstring | null—Controlled id of the item in the lightbox.
defaultOpenstring | nullnullStarting open item when uncontrolled.
onOpenChange(id: string | null) => void—Called when a tile opens or the lightbox closes.
highlightedstring | null—Forces the hover look on one tile, e.g. for keyboard-driven highlights.
fullscreenbooleanfalseThe lightbox covers the viewport instead of the gallery's own box.
classNamestring—Classes for the wrapper; the default is max-w-sm.