Masked Image

The MaskedImage component is a reusable UI element that displays images with custom mask shapes. It's built on top of Next.js's Image component and supports various mask shape variants.

Installation

Make sure you have the latest version (4.1.3+) of Tailwind CSS installed.

npx shadcn@latest add https://matsu-theme.vercel.app/r/masked-image.json

Usage

import { MaskedImage } from "@/components/ui/masked-image"; // With a specific mask shape variant <MaskedImage src="/path/to/image.jpg" alt="Description" width={500} height={500} variant="shape3" />

Available Mask Variants

House
shape1
House
shape2
House
shape3
House
shape4
House
shape5
House
shape6

Props

PropTypeDefaultDescription
srcstring(required)The source URL of the image
altstring(required)Alt text for accessibility
widthnumber(required)Width of the image
heightnumber(required)Height of the image
variant"shape1" | "shape2" | "shape3" | "shape4" | "shape5" | "shape6""shape1"The mask shape variant to apply
classNamestringundefinedAdditional CSS classes to apply