Workspace / effect / overlay

Laser Reveal

A laser beam near the bottom of the viewport that reveals your live HTML from behind it on scroll.

Workspaceeffectoverlay

npx shadcn@latest add @pax-sh/laser-reveal-reactlocal only

Tier: medium. Reduced motion: instant reveal

LaserReveal.tsx
"use client";

import { useEffect, useRef } from "react";
import { laserRevealEffect } from "@pax-sh/effects";

export interface LaserRevealProps {
  className?: string;
  reducedMotion?: boolean;
  tier?: "low" | "medium" | "high";
  children?: React.ReactNode;
}

export function LaserReveal(props: LaserRevealProps) {
  const rootRef = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const target = rootRef.current;
    if (!target) return;
    const instance = laserRevealEffect.mount(target, {
      className: props.className,
      reducedMotion: props.reducedMotion,
      tier: props.tier,
    });
    return () => instance.dispose();
  }, [props.className, props.reducedMotion, props.tier]);

  return (
    <div ref={rootRef} className={props.className} data-pax-effect="laser-reveal">
      {props.children}
    </div>
  );
}