CentercodeDitto
DittoPorygonAPI

ImageSourceEditor

Image management components for upload, editing, and display

Overview

The ImageSourceEditor family provides a complete solution for managing multiple images. It includes an editor component for uploading, reordering, and editing images, plus gallery and carousel components for display. Built with dnd-kit for drag-drop reordering and integrates with the Lightbox component for full-screen viewing.

Key Features

  • Upload images via dropzone or add external URLs
  • Drag-and-drop reordering with dnd-kit
  • Edit alt text and captions for accessibility
  • Crop and position images with visual editor
  • Gallery display with configurable columns and sizing
  • Carousel display with autoplay and navigation
  • Lightbox integration for full-screen viewing
  • Annotation overlay support for image hotspots

Module Exports

The image-source-editor module exports multiple related components:

ExportPurpose
ImageSourceEditorEditor for managing images (upload, URL, reorder, edit, crop)
ImageGalleryGrid-based image display with lightbox
ImageCarouselSlideshow display with navigation and autoplay
ImageCropDialogDialog for cropping and positioning images
ImageSourceType definition for image data structure

Examples

ImageSourceEditor

Upload images via dropzone or external URL, then reorder, edit, or crop them.

Mountain landscape with snow

Snowy mountain peaks at sunrise

Snowy mountain peaks at sunrise

Ocean waves on beach

Peaceful ocean waves

Peaceful ocean waves

2 images added. Drag to reorder, click pencil to edit, or crop icon to adjust position.

The editor supports uploading via drag-drop or file selection, adding external URLs, and managing up to 10 images. Each image can have alt text (required for accessibility), captions, and custom positioning.

ImageGallery

Grid layout with configurable columns, sizing modes, and lightbox integration.

Columns:
Sizing:
Height:

Snowy mountain peaks at sunrise

Peaceful ocean waves

Golden autumn forest trail

Dramatic sunset colors

The gallery displays images in a responsive grid. Click any image to open it in the lightbox. Configure the number of columns (1-4), sizing mode (fit, fill, contain), and maximum height.

ImageCarousel

Slideshow with navigation arrows, dot indicators, and optional autoplay.

Sizing:
Height:
1 of 4

Snowy mountain peaks at sunrise - a breathtaking view of nature

Use arrow keys or click the navigation buttons to move between images. Click on the image to open in lightbox.

The carousel shows one image at a time with navigation controls. Use arrow keys or click the navigation buttons to move between images. Enable autoplay for automatic transitions.

Props Reference

ImageSourceEditorProps

PropTypeDefaultDescription
valueImageSource[]requiredCurrent list of images
onChange(images: ImageSource[]) => voidrequiredCallback when images change
scopeTypeScopeType-Scope type for file operations (PROGRAM, PROJECT)
scopeIdstring-Scope ID for file operations
purposeFilePurposeDESIGNFile purpose for uploaded images
accessLevelFileAccessPUBLICAccess level for uploaded images
disabledbooleanfalseDisable all interactions

ImageGalleryProps

PropTypeDefaultDescription
imagesImageSource[]requiredImages to display in the gallery
columns1 | 2 | 3 | 42Number of grid columns
sizing'fit' | 'fill' | 'contain''fill'Image sizing mode (fit, fill, or contain)
maxHeight'small' | 'medium' | 'large' | 'full''medium'Maximum height for images
showCaptionsbooleanfalseShow captions below images
enableLightboxbooleantrueEnable lightbox on click
enableAnnotationsbooleantrueDisplay annotation overlays
classNamestring-Additional className for the container

ImageCarouselProps

PropTypeDefaultDescription
imagesImageSource[]requiredImages to display in the carousel
sizing'fit' | 'fill' | 'contain''fill'Image sizing mode
maxHeight'small' | 'medium' | 'large' | 'full''medium'Maximum height for images
showCaptionsbooleanfalseShow captions below current image
enableLightboxbooleantrueEnable lightbox on click
enableAnnotationsbooleantrueDisplay annotation overlays
autoplaybooleanfalseAuto-advance slides
autoplayIntervalnumber5Autoplay interval in seconds
classNamestring-Additional className for the container

ImageSource Type

PropTypeDescription
idstringUnique identifier for the image
type'blob' | 'url'Source type (uploaded blob or external URL)
srcstringImage URL
altstringAlt text for accessibility
thumbnailSrcstringOptional thumbnail URL for galleries
captionstringOptional caption text
widthnumberOriginal image width
heightnumberOriginal image height
fileSizeBytesnumberFile size in bytes (blob uploads only)
positionImagePositionCrop/position data { x, y, scale }
annotationsAnnotation[]Array of annotation hotspots

Usage

import {
  ImageSourceEditor,
  ImageGallery,
  ImageCarousel,
  type ImageSource,
} from '@/ui/components/image-source-editor';

// Editor for managing images
const [images, setImages] = useState<ImageSource[]>([]);

<ImageSourceEditor
  value={images}
  onChange={setImages}
  scopeType="PROJECT"
  scopeId={projectId}
/>

// Gallery display (grid layout)
<ImageGallery
  images={images}
  columns={3}
  sizing="fill"
  maxHeight="medium"
  showCaptions
  enableLightbox
/>

// Carousel display (slideshow)
<ImageCarousel
  images={images}
  sizing="fill"
  maxHeight="large"
  showCaptions
  autoplay
  autoplayInterval={5}
/>