Mask Cursor Effect
A cursor-following mask effect that reveals hidden content on hover. Creates an engaging reveal experience.
Component preview
Install using CLI
npx shadcn@latest add "https://www.obsidianui.dev/r/mask-cursor-effect.json"Install Manually
1
Install dependencies
npm install motion clsx tailwind-merge
2
Add util file
Create a file lib/utils.ts:
import { ClassValue, clsx } from 'clsx';import { twMerge } from 'tailwind-merge';export function cn(...inputs: ClassValue[]) {return twMerge(clsx(inputs));}
3
Copy the source code
Copy the code into components/block/mask-cursor-effect.tsx
Usage
Code
import { MaskCursorEffect } from "@/components/block/mask-cursor-effect"export function Demo() {return (<MaskCursorEffecthiddenComponent={<h1 className="text-6xl font-bold">SECRET</h1>}backgroundColor="#EA5A47"expandedMaskSize={350}><h1 className="text-6xl font-bold">HOVER ME</h1></MaskCursorEffect>)}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| children | React.ReactNode | - | Visible content |
| hiddenComponent | React.ReactNode | - | Content revealed on hover |
| backgroundColor | string | '#EA5A47' | Mask background color |
| expandedMaskSize | number | 350 | Mask size on hover |
Last updated on