Pixel Trail
Interactive grid overlay that lights up crisp square pixels beneath the cursor and dissolves them with exponential luminance decay—perfect for interactive hero stages.
#cursor#grid#retro#interactive
Customize
22px
#A855F7
0.92
Rounded Pixels
Installation
$pnpm dlx yourbrand@latest add @yourbrand/PixelTrail-TS-TWUsage (synced with live props)
<PixelTrail
gridSize={22}
color="#A855F7"
decay={0.92}
rounded
/>Source Code
PixelTrail.tsx"use client";
import React from "react";
export interface PixelTrailProps {
gridSize?: number;
color?: string;
decay?: number;
rounded?: boolean;
}
export function PixelTrail({
gridSize = 22,
color = "#A855F7",
decay = 0.92,
rounded = true,
}: PixelTrailProps) {
return (
<div
className="relative h-72 w-full overflow-hidden rounded-2xl border border-white/10"
data-grid={gridSize}
data-color={color}
data-decay={decay}
data-rounded={rounded}
/>
);
}
Props API
| Prop | Type | Default | Description |
|---|---|---|---|
| gridSize | number | 22 | Pixel tile dimensions. |
| color | string (hex) | "#A855F7" | Active pixel emission hue. |
| decay | number | 0.92 | Fade retention factor per frame. |
| rounded | boolean | true | Soften pixel tile corners. |