Workspace / effect / html-in-canvas
Particle Reveal
npx shadcn@latest add @pax-sh/particle-reveal-reactlocal onlyTier: high. Reduced motion: plain content
ParticleReveal.tsx
"use client";
import { useEffect, useRef } from "react";
import { particleRevealEffect } from "@pax-sh/effects";
export interface ParticleRevealProps {
className?: string;
reducedMotion?: boolean;
tier?: "low" | "medium" | "high";
children?: React.ReactNode;
}
export function ParticleReveal(props: ParticleRevealProps) {
const rootRef = useRef<HTMLDivElement>(null);
useEffect(() => {
const target = rootRef.current;
if (!target) return;
const instance = particleRevealEffect.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="particle-reveal">
{props.children}
</div>
);
}