v0.3 ยท 11 new shaders, zero dependencies

Gradients
that feel alive.

A WebGL gradient component for React. Twenty shaders, one prop to move between them, and nothing else to install.

Get startedOpen the playground

Now playing

default

01/12

type="aurora"

The collection

20 shaders, 22 presets.

Each one is a hand-written fragment shader driven by the same three colors. Every tile below is live, and all of them share a single WebGL context.

What is new

Rebuilt from the triangle up.

The renderer was rewritten for this release. It is smaller, it survives things the old one did not, and it learned a few tricks.

preset="spectrum"

It morphs. It never cuts.

Change the type, the colors or the speed and the canvas blends there over a noise front, at whatever duration you set.

It follows the pointer.

Set interactive and the pattern swells under the cursor. Try it on this card.

0

Dependencies.

Raw WebGL: one fragment shader and one triangle, 11 kB gzipped. The rendering library the last version shipped with is gone.

  • Scrolled out of viewPaused
  • Tab in the backgroundPaused
  • Reduced motion requestedStill frame
  • WebGL context lostRestored

Asleep when unseen.

The render loop only runs while someone can see it. No props, no observers to wire up.

Three colors in.

Every shader reads the same three colors, as hex strings or RGB objects, so a palette carries across all twenty.

Quick start

From install to a living background in a minute.

It is a client component that renders one canvas and fills its parent. Put it behind your content and it is done.

  1. 01Install

    Source codebash
    npm install gradflow
  2. 02Put it behind something

    hero.tsxtsx
    import { GradFlow } from 'gradflow'
    
    export default function Hero() {
      return (
        <section className="relative isolate h-screen">
          <div className="absolute inset-0 -z-10">
            <GradFlow preset="borealis" />
          </div>
    
          <h1>Your content, on top.</h1>
        </section>
      )
    }
  3. 03Make it yours

    Source codetsx
    <GradFlow
      config={{
        type: 'prism',
        color1: '#ff5a1e',
        color2: '#285aff',
        color3: '#78d2ff',
        speed: 0.5,
        scale: 1,
        noise: 0.1,
      }}
      transition={900}
      interactive
    />

In an interface

Behind real UI, not just a hero.

A gradient earns its place when there is something on top of it. These are working components, and their source is one click away.

See all five

Welcome back

Sign in to pick up where you left off.

New here? Create an account

Most popular

Studio

$19per seat / month
  • Unlimited projects
  • Custom domains
  • Priority rendering
  • Team seats included

Questions

Things people ask first.

Yes. GradFlow is marked as a client component, so you can import it straight into a server component. It renders an empty canvas on the server and starts drawing once it mounts.