Components/AI
Generated Image Card
AI-generated image display component with download, copy prompt, and interactive controls
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
Prop | Type | Default | Description |
---|---|---|---|
src | string | Blob | StaticImport | undefined | Image source URL, blob, or static import |
imageTitle | string | null | null | Title/alt text for the image |
width | number | 400 | Image width in pixels |
height | number | 400 | Image height in pixels |
className | string | undefined | Additional CSS classes for styling |
timestamp | string | "00:00" | Timestamp displayed in the controls |
prompt | string | "" | The prompt used to generate the image |
onLike | () => void | undefined | Callback when like button is clicked |
onDislike | () => void | undefined | Callback when dislike button is clicked |
onRegenerate | () => void | undefined | Callback when regenerate button is clicked |
onComplete | () => void | undefined | Callback when image loading completes |
hideControls | boolean | false | Whether 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