Skip to content

Hero Shader

BackgroundsMIT
View in Storybook

WebGL shader hero background with motion control and reduced-motion support.

bun add @otfdashkit/ui

Preview

Hero Shader
Loading Storybook preview…

Code

import { HeroShaderA } from '@otfdashkit/ui'

export function Example() {
  return (
    <div className="relative h-screen w-full bg-black">
      <HeroShaderA />
      <div className="relative z-10 flex h-full flex-col items-center justify-center px-6 text-center">
        <p className="font-mono text-xs uppercase tracking-[0.22em] text-white/60">— hero shader A</p>
        <h1 className="mt-4 text-5xl sm:text-6xl font-semibold tracking-tight text-white">
          Built for builders <span className="italic font-light text-white/70">who ship.</span>
        </h1>
        <p className="mt-4 max-w-xl text-base text-white/70">
          A clean-room WebGL aurora — three drifting blobs lit by your theme tokens. Pauses when offscreen, falls back to a CSS gradient if WebGL is unavailable.
        </p>
      </div>
    </div>
  )
}

Free with the SDK. This pattern ships in @otfdashkit/ui under the MIT license.

Props

Props declared in the HeroShaderA source. Inherited HTML attributes are not listed.

PropTypeDefaultDescription
backgroundreadonly [number, number, number]Background color underneath the blobs (0..1 RGB). Default very-dark.
colors[readonly [number, number, number], readonly [number, number, number], readonly [number, number, number]]Three blob colors in 0..1 RGB tuples. Default mixes primary + chart-2 + chart-3.
intensitynumber0.70..1 — how strongly each blob mixes over the background. Default 0.7.
pixelRationumber1.5Render quality (DPR cap). Default 1.5.
speednumber1Animation speed multiplier. Default 1. Set 0 to freeze.