Skip to content

shadcn.io is an independent project built on shadcn/ui

Pro

Interference Background for Solid

Fine rings from two or more sources cross into a standing moiré. For Solid with Ark UI, when a technical page needs a precise, quiet pattern.

On this page10 sections
UI library: Ark UI

Two sources sit side by side and send out fine, evenly spaced rings. Where the two sets cross they make a moiré: the rings fade where the waves cancel and show strongest where they add up, so a fan of bands stands still while the rings travel through. It's a GLSL scene on WebGL2 with no dependency. Each ring is a hairline in your theme's foreground color, dark on a light surface and light on a dark one. One more source rides the pointer and bends the pattern around it.

Use it behind a hero or a section about signals, audio, optics, data or anything measured. For one set of rings pulsing from a point, use Ripple; for rings that open where raindrops land, Drops; for the contour lines of a map, Topography. With reduced motion it holds one still frame.

Playground
Interference Background, still
Customize

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Usage

import { Interference } from "@/components/ui/interference";
<Interference class="flex min-h-[32rem] flex-col items-center justify-center">
  <h1 class="text-5xl font-semibold">Find the pattern</h1>
</Interference>

Interference is a container: whatever you put inside sits on top of the rings, in normal flow. It fills its own box, so give it a height or content. For a backdrop behind the whole page, render it empty with className="fixed inset-0 -z-10".

Presets

Fanthe default lookTry it
<Interference />
Burstthe default lookTry it
<Interference
  contrast={2}
  lineWidth={0.75}
  origin="top"
  reach={1.5}
  wavelength={6}
/>
<Interference
  accentColor="#ec4899"
  color="#6366f1"
  intensity={1.4}
  lineWidth={1.25}
  origin="center"
  sources={4}
  spread={0.22}
/>
Pondthe default lookTry it
<Interference
  contrast={0.6}
  fill={1}
  origin="center"
  softness={1}
  sources={3}
  spread={0.5}
  wavelength={30}
/>
Slitthe default lookTry it
<Interference
  angle={90}
  origin="left"
  reach={0.9}
  spread={0.1}
  wavelength={10}
/>
Triothe default lookTry it
<Interference
  origin="center"
  sources={3}
  spread={1.5}
  wavelength={18}
/>
Weavethe default lookTry it
<Interference origin="center" spread={1.6} wavelength={16} />

Each preset is a set of props, so copy one and keep tuning. Fan is the default: two sources close together at the bottom edge. Weave moves them far apart, so the rings meet head-on in a fine lattice, Trio adds a third source for a field of small stars, and Pond softens the rings into smooth waves. All but Duo take their color from your theme.

Examples

Hero

The default look with centered copy. The sources sit at the bottom edge and the rings fade as they climb (reach), so the lines behind the headline are the faint ones.

Preview width

Lattice

sources={3} with spread={1.5} puts three sources around and beyond the box, so their rings cross everywhere. color is the rings and accentColor the points where all three meet in step; contrast={0.4} keeps the rings visible between those points. The colors are passed in because the surface is fixed, bg-slate-950.

Preview width

In a card

origin="top" moves the sources to the top edge, wavelength={10} packs the rings closer, and reach={0.6} fades them out before the text at the bottom.

Preview width

Customization

color and accentColor take any CSS color, theme variables included, and follow a theme switch. Both default to var(--foreground), so the pattern is one tone; give accentColor a hue and the bands where the waves add up take it. wavelength and lineWidth are CSS pixels, so the rings keep their size on any screen. spread changes the pattern most: close sources throw a few wide bands, far ones a fine lattice.

The surface is the root's own background, bg-background by default, and the rings are drawn on it as lines, a little stronger on a light surface. A fixed dark root inside a light theme needs its own colors, since a theme variable still resolves to the theme's. fade masks an edge, opacity turns the whole scene down, and grain adds film grain.

<Interference
  accentColor="var(--chart-1)"
  class="min-h-[32rem]"
  color="var(--muted-foreground)"
  fade="top"
  sources={3}
/>

Performance

It's one WebGL2 canvas and one fragment shader with no noise and no march: for each of up to five sources (four and the pointer's) a distance, an exponential, one line and a sine and cosine, then one color mix a pixel. It draws only while it's on screen and the tab is visible, shares one frame loop with every other background on the page, and lowers its own resolution if frames run long. quality sets the render scale yourself, and paused holds the frame.

Accessibility

The scene is decoration: it's hidden from assistive tech and lets every click through to your content. With reduced motion it draws one still frame and ignores the pointer. Nothing flashes: a ring moves 0.12 wavelengths a second, under 2 CSS pixels at the default, and the bands stay where they are.

The rings are hairlines at 46% of the foreground color at most on a light surface and 38% on a dark one, less with distance from the sources. Over the hero demo's copy, foreground text measured 11.5:1 at worst on a light surface and 11.2:1 on a dark one, averaged over the width of a letter's stroke. For body copy over the densest part, next to the sources, lower intensity or shorten reach.

FAQ

How do I change the colors?

color is the rings and accentColor the places where the waves add up. Both take any CSS color: hex, oklch() or a theme variable such as var(--primary), which follows your theme when it changes. Leave them equal for a one-tone pattern, or set accentColor to a hue so the standing bands pick it up. The two are mixed in OKLab, so the steps between them stay clean.

Why do the bands stand still while the rings move?

Every source sends its rings out at the same speed, so the difference between two sources' waves at any point never changes. Where the waves arrive in step they add up, and where one arrives half a wavelength late they cancel. Those places depend only on the positions of the sources, which wander by about a wavelength, so the bands shift slowly and never race.

How do I get fewer, wider bands, or a finer lattice?

spread is the distance between the sources as a share of the box's shorter side. Near 0.1 two sources throw a fan of a few wide bands. Past 1 they sit at or beyond the edges and the rings cross in a fine lattice. wavelength sets the ring spacing in CSS pixels, from 6 to 48, and sources goes from 2 to 4.

Does it follow dark mode?

Yes. With no props the rings use var(--foreground), so they are dark on a light theme and light on a dark one, and they are read again when the theme switches. If you put it on a surface that doesn't follow the theme, such as bg-slate-950, pass color and accentColor yourself.

How do I put it behind the whole page?

Render it empty with className="fixed inset-0 -z-10". The pointer's source still follows the pointer there, since the scene listens on the window. origin picks where the sources gather: the center or one of the four edges, and reach how far the rings get before they fade.

Do the fine lines shimmer or alias?

Each ring is antialiased over one device pixel, and its width and spacing are in CSS pixels, so it looks the same at any pixel ratio. If the spacing would fall under about four device pixels, as it can with a low quality, the rings fade out instead of turning into noise. A moiré is itself a beat between two line sets, so some texture is the point.

Does it work with Next.js and server components?

Yes. Import it into a server component and it renders its box and your content on the server; the canvas starts in the browser and fades in over the surface. It needs WebGL2, which every current browser has. Without it the box keeps its background, or the fallback you pass.

What happens with reduced motion, and on touch screens?

With reduced motion it draws one still frame of the rings and the bands, and the pointer's source is off. On a touch screen the rings travel as usual but touch never adds a source, so scrolling isn't disturbed. interactive={false} turns the pointer off everywhere, and flow={0} stops the rings while the bands still drift.

API Reference

Interference

data-slot="interference"

PropType
accentColor?string

The CSS color of the rings where the waves add up. By default the same as color, so the pattern is one tone.

Default
"var(--foreground)"
angle?number

Turns the arrangement of the sources, in degrees.

Default
0
color?string

The CSS color of the rings. A theme variable such as var(--foreground) follows your theme.

Default
"var(--foreground)"
contrast?number

How strongly the standing pattern shows: 0 draws plain rings, higher dims them where the waves cancel.

Default
1
fade?"none" | "radial" | "top" | "bottom" | "left" | "right"

Which edges fade out to the surface: radial keeps the middle, the others name the side that fades.

Type
"none" | "radial" | "top" | "bottom" | "left" | "right"
Default
"none"
fallback?string

What shows until the first frame and in browsers without WebGL2: a CSS background value that looks like the scene.

fill?number

A soft tint where the waves add up, from 0 (lines only) to 1.

Default
0.5
flow?number

How fast the rings travel outward. 0 keeps them in place while the sources still wander.

Default
1
grain?number

Film grain over the scene, from 0 to 1.

Default
0
intensity?number

How strongly the rings show.

Default
1
interactive?boolean

Whether the scene follows the pointer and answers a press. Touch never moves it, so scrolling a page on a phone isn't disturbed.

Default
true
lineWidth?number

The width of a ring's line, in CSS pixels.

Default
1
opacity?number

How strongly the scene shows over the surface, from 0 to 1.

Default
1
origin?"center" | "top" | "bottom" | "left" | "right"

Where the sources gather: the middle of the box or one of its edges.

Type
"center" | "top" | "bottom" | "left" | "right"
Default
"bottom"
paused?boolean

Holds the current frame.

Default
false
quality?number

Render scale, from 0.25 to 1, of the screen's pixels (capped at 2×). Lower is cheaper and softer.

Default
1
reach?number

How far the rings travel before they fade, as a share of the box's longer side.

Default
0.75
softness?number

How soft the rings are, from 0 (hairlines) to 1 (smooth waves).

Default
0
sources?number

How many sources send out rings, from 2 to 4.

Default
2
speed?number

Animation speed: 1 is normal, 0 holds the frame.

Default
1
spread?number

How far apart the sources sit, as a share of the box's shorter side: close together they throw a fan of wide bands, far apart a fine lattice.

Default
0.13
time?number

A fixed moment, in seconds: draws it and doesn't animate.

wavelength?number

The distance from one ring to the next, in CSS pixels.

Default
14