Image

The Image component displays AI-generated images from base64 encoded data. It's designed to work seamlessly with the AI SDK's Experimental_GeneratedImage type and provides automatic styling with proper accessibility features.

Example generated image

Installation

pnpm dlx shadcn-svelte@latest add https://svelte-ai-elements.vercel.app/r/image.json

If you prefer using jsrepo, please install via the command below:

pnpm dlx jsrepo add @ai/elements/ai-elements/image

Props

Image

NameTypeDefault
base64
string
uint8Array
Uint8Array
mediaType
string
alt
string
class
string
ref
HTMLImageElement | null
...restProps
HTMLImgAttributes