Skip to content

Aurora

Add curtains of light behind a hero, with space below for your copy.

import { Aurora } from '@youj/motion/backgrounds'

Experimental: what this label means

Installation & usage

npm i @youj/motion

For an app already set up with npx @youj/cli init, which installs the peers (@youj/core, @youj/motion, motion and Base UI) and wires the provider. New app? Start at Installation.

Use it for a launch or a hero that should feel atmospheric: a new product, a beta, a sign-in screen. The curtains hang in the upper part of the frame and fade out below the horizon, so the lower part stays calm for a headline and a call to action. Don't use it behind dense content or in more than one section per page. Its glow is a statement, and two of them compete.

The aurora fills its nearest positioned ancestor and paints behind your content, so make the container relative and isolate. Place the copy below the horizon.

import { Aurora } from '@youj/motion/backgrounds'

export function LaunchHero() {
  return (
    <section className="relative isolate flex min-h-[640px] flex-col justify-end pb-24">
      <Aurora />
      <p className="relative text-5xl font-semibold">Answers that arrive before the question</p>
    </section>
  )
}

Three layers drift at different depths. Each has a bright lower edge that swells and folds, rays that hang upward and fade over the curtain's height, and pulses of brightness that travel along it. On a dark canvas the layers add light. On a light canvas they tint it, so the same component works in both modes.

Reference

Propscolors, intensity, speed… (6)

Props

Aurora props
PropType
colors[string, string, string]

Three CSS colors, back layer to front. Default: an analogous family around the accent token.

–
intensitynumber

Brightness of the ribbons, 0–1.5.

default 1

1
speednumber

Drift speed multiplier.

default 1

1
horizonnumber

Height of the lowest curtain edge, 0 (bottom) to 1 (top).

default 0.58

0.58
interactiveboolean

Ribbons lean gently with the pointer.

default true

true
classNamestring–
PerformanceIt's one WebGL2 fragment shader on a single full-screen triangle,…

Performance

It's one WebGL2 fragment shader on a single full-screen triangle, rendered at a device-pixel ratio capped at 2, with dithering against 8-bit banding in the soft gradients. The loop pauses when the aurora is offscreen or the tab is hidden, recovers from a lost GL context, and releases the context on unmount. Without WebGL2, it falls back to a static CSS wash of the same colors.

MotionDrift, pointer lean · reduced motion

Motion

Motion tokens
MomentTokens
Driftlayers, folds and pulses, on one shader clock
no token

speed ÷ time scale

speed ÷ time scale
Pointer leaneases in and out with the pointer
no token

smoothed per frame

smoothed per frame

Reduced motion

Draws one still frame of the curtains and stops. There's no drift and no lean, and the frame redraws only when the size, the props or the theme change.

Reduced motion

The aurora draws one composed frame and holds it. The curtains, their colors and the quiet space for your copy stay the same, so the hero looks as designed, only still. Switch on Reduced motion in any preview above to compare.

AccessibilityARIA

Accessibility

  • It's decorative: the element is aria-hidden and ignores pointer events.
  • Keep text below the horizon, where the frame is quiet, and check its contrast there. On a light canvas the curtains tint, so muted text over the brightest band can drop below 4.5:1.
  • The drift is slow, and it stops offscreen. Under reduced motion the aurora doesn't move at all.