|Kit

AmbientBackground

A decorative, brand-tinted page background — a soft radial glow plus a fine noise texture — so a flat page fill reads as a considered surface instead of a plain color.

You're looking at it right now — this docs site renders AmbientBackground once, in its root layout, and every page you navigate to (including this one) is the live example.

import { AmbientBackground } from "@42-central/ui-react/ambient-background";

// app/layout.tsx
<body>
  <AmbientBackground />
  {children}
</body>;

Render it once, as the first child of your root layout. It's position: fixed, so a single instance covers the whole viewport regardless of scroll position or page height — later content naturally paints over it as long as it's mounted first. It's purely decorative: aria-hidden, pointer-events-none, and hidden under forced-colors (Windows High Contrast Mode), since a background tint has no place overriding a user's forced palette.

The glow and noise are CSS custom properties (--ambient-glow / --ambient-noise, defined once in theme.css, brand-tinted and theme-aware via data-theme) rather than hardcoded in the component — override either on :root in your own stylesheet to reskin it without forking the component.

Glow and noise render as two independent position: fixed elements rather than one wrapper containing two children — nesting the noise layer's blend mode inside a fixed wrapper would trap it inside that wrapper's own isolated stacking context, unable to blend against the real page content underneath. The examples below constrain each layer to a bounded box via classNames (overriding the default fixed inset-0 -z-10 on each) purely so they fit inside the preview frame — in real use you pass no props at all.

Both layers (default)

Page content

Code

<AmbientBackground />

Glow only

Turn off the noise layer with withNoise={false} for just the radial tint.

Code

<AmbientBackground withNoise={false} />

Noise only

Turn off the glow with withGlow={false} for just the grain texture — useful over a background you're already tinting yourself.

Code

<AmbientBackground withGlow={false} />

Starfield

withStarfield adds a sky over the glow and noise: soft violet nebulae, dust that dims and comes back in groups, a few brighter stars that breathe, and now and then a meteor. It's seeded, so every render — server and client, every visit — draws the same sky. The motion is slow on purpose: the sky is never seen moving, only found changed.

Page content

Code

<AmbientBackground withStarfield />

Like glow and noise, each part is its own position: fixed layer — five clouds, the stars, the meteors — so classNames takes nebula, stars and meteors too. Render one starfield per page: its SVG patterns use fixed ids.

API

Prop

Type

Accessibility

AmbientBackground is purely decorative:

  • aria-hidden="true" — assistive tech skips it entirely.
  • pointer-events-none — it never intercepts clicks or taps meant for real content underneath.
  • forced-colors:hidden — it disappears under Windows High Contrast Mode, since a decorative tint has no place overriding a user's forced palette there.
  • Reduced motion stills the starfield: with prefers-reduced-motion: reduce, or data-motion="reduced" on <html> for apps that let people choose in-app, the clouds, dust and stars hold still and the meteors don't appear.

Changelog

v0.26.0
  • The starfield's nebula holds still

    #449
v0.25.0
  • The dark sky is tuned against Figma's Background / Cosmos: the first violet cloud and the grain are retuned

    #438
v0.24.0
  • New withStarfield prop: a slowly moving starry sky — nebulae, stars and meteors — over the glow and noise

    #436
v0.20.0
  • glow/noise are renamed withGlow/withNoise; the old names work until the next minor

    #390
v0.4.0
  • New AmbientBackground: a brand-tinted glow and noise texture for the page background

    #41

On this page