Skip to content
Lenso UI

Image

Migration guide for Image from HeroUI v2 to v3

The Image component has been removed in HeroUI v3. Use native HTML <img> element or Next.js Image component with Tailwind CSS classes instead.

Key Changes

1. Component Removal

v2: <Image> component from @lenso/ui
v3: Native HTML <img> element or Next.js Image component

2. Features Mapping

The v2 Image component had several features that need to be replaced:

v2 Featurev3 EquivalentNotes
radius proprounded-* Tailwind classesUse rounded-sm, rounded-md, rounded-lg, rounded-full
shadow propshadow-* Tailwind classesUse shadow-sm, shadow-md, shadow-lg
isBlurred propManual blur implementationUse CSS filter: blur() or Tailwind blur-* utilities
isZoomed propManual hover zoomUse hover:scale-* Tailwind classes
fallbackSrc propManual error handlingUse onError handler with state
disableSkeleton / Loading skeletonManual loading stateUse React state + conditional rendering
removeWrapper propDirect renderingNo wrapper needed, render <img> directly

Structure Changes

In v2, Image was a component wrapper around the native <img> element:

import { Image } from "@lenso/ui";
export default function App() {  return (    <Image      src="https://example.com/image.jpg"      alt="Example image"      width={300}      height={200}    />  );}

In v3, use the native <img> element directly with Tailwind CSS classes:

export default function App() {  return (    <img      src="https://example.com/image.jpg"      alt="Example image"      width={300}      height={200}      className="rounded-lg"    />  );}

Migration Examples

If you're using Next.js, use the optimized Image component:

import { Image } from "@lenso/ui";
<Image  src="/image.jpg"  alt="Example"  width={300}  height={200}/>

With Zoom Effect

<Image isZoomed src="..." alt="..." />

With Blur Effect

<Image isBlurred src="..." alt="..." />

With Fallback Image

<Image  src="https://example.com/image.jpg"  fallbackSrc="/fallback.jpg"  alt="Example"/>

With Loading Skeleton

<Image  src="https://example.com/image.jpg"  alt="Example"  disableSkeleton={false}/>

Combined Features

<Image  src="https://example.com/image.jpg"  alt="Example"  radius="lg"  shadow="md"  isZoomed  isBlurred  width={400}  height={300}/>

Creating a Reusable Image Component (Optional)

If you frequently use images with similar features, you can create a reusable component:

import { Image } from "@lenso/ui";
<Image  src="..."  radius="lg"  shadow="md"  isZoomed/>

Complete Example

import { Image } from "@lenso/ui";
export default function App() {  return (    <div className="space-y-4">      <Image        src="https://example.com/image1.jpg"        alt="Image 1"        width={300}        height={200}        radius="lg"        shadow="md"      />      <Image        src="https://example.com/image2.jpg"        alt="Image 2"        width={300}        height={200}        isZoomed        radius="lg"      />      <Image        src="https://example.com/image3.jpg"        alt="Image 3"        width={300}        height={200}        isBlurred        radius="full"      />    </div>  );}

Summary

  1. Component Removed: Image component no longer exists in v3
  2. Import Change: Remove import { Image } from "@lenso/ui"
  3. Use Native Element: Replace with native <img> HTML element or Next.js Image
  4. Features: Implement blur, zoom, skeleton, and fallback manually
  5. Styling: Apply Tailwind CSS classes directly for radius, shadow, and effects

Migration Steps

  1. Remove Import: Remove Image from @lenso/ui imports
  2. Replace Component: Replace all <Image> instances with <img> elements
  3. Add Tailwind Classes: Apply equivalent Tailwind classes for styling (radius, shadow)
  4. Implement Features: Add manual implementations for blur, zoom, skeleton, and fallback if needed
  5. Use Next.js Image: If using Next.js, consider using next/image for optimization
  6. Optional: Create reusable wrapper components for frequently used patterns

Next.js Image Component

If you're using Next.js, the Image component from next/image provides:

  • Automatic image optimization
  • Lazy loading by default
  • Responsive images with srcSet
  • Placeholder blur support
  • Built-in loading states
import Image from "next/image";
<Image  src="/image.jpg"  alt="Example"  width={300}  height={200}  className="rounded-lg shadow-md"  placeholder="blur" // Optional: blur placeholder  blurDataURL="data:image/..." // Optional: base64 blur data/>