Workspace / effect / overlay

Magnify

A sci-fi scanner lens that magnifies your live HTML inside a HUD reticle, with click ripples that bend the page.

Workspaceeffectoverlay

npx shadcn@latest add @pax-sh/magnify-reactlocal only

Tier: high. Reduced motion: static reticle

Magnify.tsx
"use client";

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

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

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

  useEffect(() => {
    const target = rootRef.current;
    if (!target) return;
    const instance = magnifyEffect.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="magnify">
      {props.children}
    </div>
  );
}