Skip to content
DocumentationPerformance

Docs · Using components

Performance

Canvas and WebGL effects cost more than a button. These are the rules for keeping your page smooth.

On this page

Mount only what's visible

Most canvas or WebGL components pause when they leave the screen, and reduce or turn off their animation with reduced motion. To keep them from even mounting until they're needed, load them lazily:

TSX
import { lazy, Suspense } from "react";

const Aurora = lazy(() => import("furin-ui/aurora"));

export function Section() {
  return (
    <div style={{ position: "relative", height: 360 }}>
      <Suspense fallback={null}>
        <Aurora />
      </Suspense>
    </div>
  );
}

In Astro use client:visible (see the example).

WebGL contexts

Browsers limit how many WebGL contexts a page can keep alive (in Chrome it's around 16): go over it and they shut down the oldest ones, and those backgrounds go blank. A rule of thumb: one WebGL background per section, and only a few at a time. On this site we cap ourselves at 4 live WebGL contexts per page.

Size and resolution

  • A screen-sized background draws far more pixels than one inside a card. If the effect doesn't need to fill everything, give it a smaller container.
  • Canvas components scale with devicePixelRatio and cap it (usually at 2), so a very dense screen doesn't multiply the work.
  • Some have props that cut the work, such as density, which changes how many drops or particles they draw; each component's table says which ones.

Package size

The npm package is ESM and marks only its .css files as side effects, so your bundler can drop whatever you don't use. To be sure, import per component (import DecipherText from "furin-ui/decipher-text") or install with shadcn, which only copies what you ask for.

How to measure

In Chrome, open DevTools, go to Performance and record while you scroll and move the cursor around the page. For a quick look, turn on Frame Rendering Stats in the Rendering tab. Also test on a mid-range phone: that's where a heavy background shows up first.

Spot a mistake or something missing? Email us at contacto@furin.dev.