Command Palette

Search for a command to run...

UploadThing/UploadThing Image Grid

UploadThing Image Grid

A multi-image upload grid with preview thumbnails, remove buttons, and configurable columns.

Open in v0Open in
Mountain landscape
Nature scene
Forest path

Overview

A grid-based multi-image uploader. Configure columns and max images. Hover to reveal remove buttons.

Installation

npx shadcn@latest add @elements/uploadthing-image-grid

Usage

import { UploadThingImageGrid } from "@/components/elements/uploadthing/uploadthing-image-grid";

export function GalleryUploader() {
  const [images, setImages] = useState<string[]>([]);

  return (
    <UploadThingImageGrid
      value={images}
      onChange={setImages}
      maxImages={9}
      columns={3}
    />
  );
}

Props

PropTypeDefaultDescription
valuestring[][]Current image URLs
onChange(urls: string[]) => void-Called when images change
onUpload(files: File[]) => void-Called when files are selected
onRemove(url: string, index: number) => void-Called when image is removed
maxImagesnumber9Maximum number of images
columns2 | 3 | 43Grid columns
disabledbooleanfalseDisable upload
classNamestring-Additional CSS classes

Features

  • Configurable grid columns (2/3/4)
  • Max images limit with counter
  • Hover-to-remove on images
  • Add button when under limit
  • Responsive grid layout