DocumentationMask Cursor Effect

Mask Cursor Effect

A cursor-following mask effect that reveals hidden content on hover. Creates an engaging reveal experience.

Install using CLI

npx shadcn@latest add "https://obsidianui.dev/r/mask-cursor-effect.json"

Install Manually

1

Install dependencies

npm install framer-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/ui/mask-cursor-effect.tsx

Usage

1import { MaskCursorEffect } from "@/components/ui/mask-cursor-effect"
2
3export function Demo() {
4return (
5 <MaskCursorEffect
6 hiddenComponent={<h1 className="text-6xl font-bold">SECRET</h1>}
7 backgroundColor="#EA5A47"
8 expandedMaskSize={350}
9 >
10 <h1 className="text-6xl font-bold">HOVER ME</h1>
11 </MaskCursorEffect>
12)
13}

Props

Prop NameTypeDefaultDescription
childrenReact.ReactNode-Visible content
hiddenComponentReact.ReactNode-Content revealed on hover
backgroundColorstring'#EA5A47'Mask background color
expandedMaskSizenumber350Mask size on hover