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-TW
Usage (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

PropTypeDefaultDescription
gridSizenumber22Pixel tile dimensions.
colorstring (hex)"#A855F7"Active pixel emission hue.
decaynumber0.92Fade retention factor per frame.
roundedbooleantrueSoften pixel tile corners.