Skip to content

Progressive Image

The Progressive Image component displays an image with a loading animation placeholder until the full image is loaded, enhancing user experience during image loading.

vue
<template>
  <ProgressiveImage
    src="https://example.com/photo.jpg"
    alt="A beautiful landscape"
    :width="400"
    :height="300"
  />
</template>

<script setup lang="ts">
import { ProgressiveImage } from '@/components/kuro/progressive-image';
</script>

Installation

bash
npx kuro-ui add progressive-image
bash
npx github:Bartek-Nowak/Kuro add progressive-image

Features

  • Shows a loading placeholder with various Tailwind CSS animations while the image loads.
  • Smoothly fades in the full image once loaded.
  • Requires fixed width and height to prevent layout shifts.
  • Uses only Tailwind CSS utility classes for animations and styling.

Props

PropTypeDescription
srcstringURL of the main image to display
altstringAlternative text for the image (optional)
variantstringVisual style variant for the loading animation (default: pulse)
widthnumberFixed width of the container in pixels
heightnumberFixed height of the container in pixels
classstringAdditional Tailwind CSS classes (optional)

Variants

VariantDescription
pulseGray background with pulse animation
bounceGray background with bounce animation
spinSpinner with border and spin animation
pingGray circle with ping animation
flashGray background with custom pulse animation (1.5s infinite)
shimmer_simpleGradient shimmer with pulse animation

Usage Example

vue
<template>
  <ProgressiveImage
    src="https://example.com/photo.jpg"
    alt="A beautiful landscape"
    :width="400"
    :height="300"
    variant="spin"
  />
</template>

<script setup lang="ts">
import { ProgressiveImage } from '@/components/kuro/progressive-image';
</script>