Particle Logo

Add a particle logo animation to Next.js (App Router)

Next.js renders Server Components by default, while particle animations rely on HTML5 Canvas and requestAnimationFrame. Wrap the exported TSX component as a Client Component or load it with ssr: false.

Updated

1. Export the React component

Open the workbench, upload an SVG or PNG logo (or pick one from the 3,400+ built-in brand icons), choose one of the 9 effects, and download PixelLogoLoader.tsx from the React tab (Pro plan).

2. Mark it as a Client Component

The exported file uses useRef, useEffect, and ResizeObserver. Save it as src/components/PixelLogoLoader.tsx, add 'use client'; on line 1, and render it inside a client wrapper:

'use client';

import { PixelLogoLoader } from '@/components/PixelLogoLoader';

export function HeroLogo() {
  return (
    <div style={{ width: '100%', maxWidth: 420, margin: '0 auto' }}>
      <PixelLogoLoader
        variant="mobius-flow"
        height={320}
        duration={3.2}
        interactive
      />
    </div>
  );
}

3. Prevent layout shift during SSR

If you want to skip server rendering for the canvas entirely while reserving space to protect your CLS score, wrap the import with next/dynamic:

import dynamic from 'next/dynamic';

const PixelLogoLoader = dynamic(
  () => import('@/components/PixelLogoLoader').then((m) => m.PixelLogoLoader),
  { ssr: false, loading: () => <div style={{ height: 320 }} /> }
);

4. Free-plan alternative

On the free plan, export the standalone HTML5 file, place it in public/logo-loader.html, and mount it in an <iframe src="/logo-loader.html"> with a fixed height. See the full React guide for every prop and loading-screen pattern.

Open the workbench

More guides