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 Feature | v3 Equivalent | Notes |
|---|---|---|
radius prop | rounded-* Tailwind classes | Use rounded-sm, rounded-md, rounded-lg, rounded-full |
shadow prop | shadow-* Tailwind classes | Use shadow-sm, shadow-md, shadow-lg |
isBlurred prop | Manual blur implementation | Use CSS filter: blur() or Tailwind blur-* utilities |
isZoomed prop | Manual hover zoom | Use hover:scale-* Tailwind classes |
fallbackSrc prop | Manual error handling | Use onError handler with state |
disableSkeleton / Loading skeleton | Manual loading state | Use React state + conditional rendering |
removeWrapper prop | Direct rendering | No 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
With Next.js Image (Recommended)
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
- Component Removed:
Imagecomponent no longer exists in v3 - Import Change: Remove
import { Image } from "@lenso/ui" - Use Native Element: Replace with native
<img>HTML element or Next.jsImage - Features: Implement blur, zoom, skeleton, and fallback manually
- Styling: Apply Tailwind CSS classes directly for radius, shadow, and effects
Migration Steps
- Remove Import: Remove
Imagefrom@lenso/uiimports - Replace Component: Replace all
<Image>instances with<img>elements - Add Tailwind Classes: Apply equivalent Tailwind classes for styling (radius, shadow)
- Implement Features: Add manual implementations for blur, zoom, skeleton, and fallback if needed
- Use Next.js Image: If using Next.js, consider using
next/imagefor optimization - 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/>