Workspace / effect / overlay

VHS

Worn tape playback with wave, head-switching noise, chroma bleed, and grain over your live HTML.

Workspaceeffectoverlay

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

Tier: low. Reduced motion: static scanlines

Vhs.tsx
"use client";

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

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

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

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