Disable network cache to see loading state
<script setup lang="ts">
import { Image, ImageError, ImageLoading, ImageSource } from "@/components/image";
</script>
<template>
<Image>
<ImageSource class="w-72 aspect-video" src="https://picsum.photos/id/229/600/400" alt="..." />
<ImageLoading as-child>
<div class="w-72 aspect-video p-2 text-center text-muted-foreground bg-muted">
Loading...
</div>
</ImageLoading>
<ImageError>
<div class="p-2 text-center text-destructive-foreground bg-destructive">
An error occurred while loading the image.
</div>
</ImageError>
</Image>
</template>
Features
- Loading states — Automatic detection of loading, error, and success states
- Fallback support — Display placeholder content during loading or on error
- Composable — Flexible slot-based architecture with
ImageSource,ImageLoading,ImageError, andImageFallback
Installation
Install from the Vuzeno registry with the shadcn-vue CLI:
bunx --bun shadcn-vue@latest add https://vuzeno.com/r/image.json