@gfazioli/mantine-scene
A composable decorative background component for React applications built with Mantine. Layer gradients, glow blobs, dot grids, mesh gradients, and noise textures to create rich atmospheric backgrounds.
Installation
After installation import package styles at the root of your application:
You can import styles within a layer @layer mantine-scene
by importing @gfazioli/mantine-scene/styles.layer.css
file.
Usage
Scene is a decorative background container that
composes multiple visual layers: gradients, glow
blobs, dot grids, mesh gradients, noise textures,
star fields, shooting stars, snow, and auroras.
Place it behind your content to create rich,
atmospheric backgrounds.
The root element has aria-hidden="true" since
it is purely decorative.
Fullscreen
Set fullscreen to cover the entire viewport with
position: fixed. The scene sits behind all content
at z-index: 0 by default (configurable via the
zIndex prop).
See the fullscreen demo page →
Reduced Motion
Scene respects prefers-reduced-motion by default.
Use the reducedMotion prop to control behavior:
'auto'(default) — disables animations when the user has enabled reduced motion in their OS settings'always'— always disables all animations'never'— keeps animations regardless of user preference
Interactive
Set interactive on the root Scene to enable mouse
tracking. Sub-components that support it will react
to the cursor position automatically:
Scene.StarWarp— focal point follows the mouseScene.Glow— blob position follows the mouseScene.Gradient— radial/conic gradient center follows the mouse
When the mouse leaves the scene, components fall back to their default position props.
Responsive Props
Some props accept responsive objects following Mantine's breakpoint convention. This is useful for reducing particle counts on mobile or adjusting sizes across viewports.
Supported responsive props:
Scene.Glow—size,blurScene.DotGrid—spacingScene.StarField—countScene.StarWarp—countScene.Snow—count
Plain number values continue to work as before — responsive objects are entirely opt-in.
Gradient
Scene.Gradient supports three types: radial
(default), linear, and conic. Use from and
to with Mantine theme colors, or pass raw CSS
color stops via colors.
Set animate to enable rotate (hue-rotate) or
pulse (opacity oscillation) animations.
Glow
Scene.Glow renders animated floating blobs.
Each blob can be positioned, sized, and animated
independently. Disable animation with
animate={false}.
Choose between animation types: float (default),
pulse (scale oscillation), and breathe (opacity
oscillation). Use delay to stagger multiple blobs.
DotGrid
Scene.DotGrid creates a repeating dot pattern.
Enable stagger for a honeycomb-like layout.
Use fade to mask the edges (radial, top,
bottom, or edges).
Mesh
Scene.Mesh overlays multiple radial gradients
to simulate a mesh gradient effect. Define color
stops with position and spread.
Set animate to enable a hue-rotate shift. Use
blend to change the CSS mix-blend-mode.
Noise
Scene.Noise adds a film grain texture via an
inline SVG filter. Control the noise with seed,
type, and octaves. Use tint with a Mantine
theme color to overlay a color tint.
StarField
Scene.StarField renders a CSS-only star field
using box-shadow on a single element per layer.
Stars are positioned deterministically via a PRNG
seeded with the seed prop.
Enable twinkle for a staggered opacity animation
across three layers.
StarWarp
Scene.StarWarp creates a classic hyperspace / warp
speed effect where stars radiate from a configurable
focal point. Stars scale up as they move outward,
simulating depth and perspective.
Use direction to choose between flying away (out)
or approaching (in). Move the focal point with
focalX / focalY to shift the vanishing point.
Enable trail for elongated streaks.
ShootingStar
Scene.ShootingStar creates streaks of light that
traverse the scene at a configurable angle. Each
trail has a gradient from transparent to the chosen
color.
Control count (number of lanes), trailLength,
speed, and minInterval/maxInterval between
appearances.
Snow
Scene.Snow renders falling snowflakes with
horizontal drift. Each flake has a randomized size,
speed, and position (deterministic via seed).
Use wind (-1 to 1) to bias the drift direction
and speed as a multiplier on fall duration.
Aurora
Scene.Aurora creates shimmering aurora borealis
bands. Each band is a blurred, colored rectangle
with a wave animation.
Customize colors (Mantine theme colors), bands
count, position (top/center/bottom), blur,
and opacity.
Combined
All sub-components can be composed freely. Layer order follows DOM order.