Components/AI

Generated Image Card

AI-generated image display component with download, copy prompt, and interactive controls

Live Preview
Open in
Aucune image à afficher
1:45

Example

export default function GeneratedImageCardExample() {
  const handleLike = () => {
    console.log('Image liked')
  }

  const handleDislike = () => {
    console.log('Image disliked')
  }

  const handleRegenerate = () => {
    console.log('Regenerating image')
  }

  const handleComplete = () => {
    console.log('Image generation completed')
  }

  return (
    <GeneratedImageCard
      src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400&h=400&fit=crop"
      imageTitle="AI Generated Image"
      prompt="A serene mountain landscape at sunset with golden light"
      timestamp="2:30"
      hideControls={false}
      onLike={handleLike}
      onDislike={handleDislike}
      onRegenerate={handleRegenerate}
      onComplete={handleComplete}
      className="w-full"
    />
  )
}

Documentation

PropTypeDefaultDescription
srcstring | Blob | StaticImportundefinedImage source URL, blob, or static import
imageTitlestring | nullnullTitle/alt text for the image
widthnumber400Image width in pixels
heightnumber400Image height in pixels
classNamestringundefinedAdditional CSS classes for styling
timestampstring"00:00"Timestamp displayed in the controls
promptstring""The prompt used to generate the image
onLike() => voidundefinedCallback when like button is clicked
onDislike() => voidundefinedCallback when dislike button is clicked
onRegenerate() => voidundefinedCallback when regenerate button is clicked
onComplete() => voidundefinedCallback when image loading completes
hideControlsbooleanfalseWhether to hide the control buttons

Types

interface GeneratedImageCardProps {
  src?: string | Blob | StaticImport
  imageTitle?: string | null
  width?: number
  height?: number
  className?: string
  timestamp?: string
  prompt?: string
  onLike?: () => void
  onDislike?: () => void
  onRegenerate?: () => void
  onComplete?: () => void
  hideControls?: boolean
}

Features

  • Multiple Image Sources: Support for URLs, blobs, base64, and static imports
  • Download Functionality: One-click download with proper filename handling
  • Copy Prompt: Copy the generation prompt to clipboard with visual feedback
  • Interactive Controls: Like, dislike, and regenerate functionality
  • Loading States: Smooth loading transitions with spinner indicators
  • Responsive Design: Adapts to different screen sizes with proper aspect ratios
  • Dark Mode Support: Full dark mode compatibility with appropriate styling
  • Accessibility Focused: Proper ARIA labels and keyboard navigation support