UploadKit
SDK@uploadkitdev/react

UploadGalleryGrid

A Pinterest-style image gallery grid where thumbnails appear as files upload, each with a circular progress overlay.

Drop images and watch them appear in a responsive grid. Each cell shows a live thumbnail (via URL.createObjectURL) with a dark overlay and circular progress ring that fades away on completion. Perfect for image-heavy upload flows.

Design inspiration: Pinterest, Instagram gallery, iCloud photo upload.

motion is an optional peerDependency. Without it, cells fade in via CSS transitions. pnpm add motion for spring scale-in entrances and AnimatePresence overlay removal.

Pinterest · Instagram — gallery grid

Basic usage

import { UploadGalleryGrid } from '@uploadkitdev/react';

export default function Page() {
  return (
    <UploadGalleryGrid
      route="galleryUploader"
      accept={['image/*']}
      maxFiles={12}
      columns={4}
      onUploadComplete={(results) => {
        console.log('Gallery:', results.map((r) => r.url));
      }}
    />
  );
}

Props

PropTypeDefaultDescription
routestringRequired. Route name from your file router.
acceptstring[]['image/*']Accepted MIME types. Defaults to images only.
maxSizenumberMaximum file size in bytes.
maxFilesnumberMaximum number of files.
columnsnumber3Number of grid columns.
metadataRecord<string, unknown>JSON-serializable metadata forwarded to the server.
onUploadComplete(results: UploadResult[]) => voidCalled after all files upload successfully.
onUploadError(error: Error) => voidCalled on individual file failure.
classNamestringAdditional CSS class(es).

UploadGalleryGrid accepts a ref forwarded to the outer <div>.

Theming

VariableDefaultPurpose
--uk-gallery-cols3Grid column count (also configurable via columns prop)
--uk-primaryProgress ring fill color
--uk-borderEmpty state border
--uk-text, --uk-text-secondaryEmpty state label colors
--uk-successCheckmark color on completion
--uk-errorError icon overlay color

Visual states

StateAppearance
EmptyDashed border spanning all columns, upload icon + "Drop images here"
UploadingThumbnail grid with dark overlay + circular SVG progress ring per cell
SuccessOverlay fades out, full-brightness image
ErrorOverlay stays with error icon

Accessibility

  • Empty state is role="button" — click opens file picker
  • Grid cells have alt text derived from filename
  • Progress ring has role="progressbar" with aria-valuenow
  • Blob URLs are revoked on unmount (no memory leaks)
  • Respects prefers-reduced-motion

On this page