shadcn.io is an independent project built on shadcn/ui
Light Waves Background for Svelte
Translucent hills of light rise in layers from the bottom edge. For Svelte with Ark UI, when a hero needs depth under its copy.
On this page10 sections
Translucent hills of light stand one behind the other on the bottom edge of the box. Each hill is the area under a slow wave of three sines, drawn by a GLSL scene on WebGL2 with no dependency: a hairline of light sits on its crest, a glow dies away below it, and the color runs from the crest down into the hill. The far hills are taller, dimmer and slower, which gives the stack its depth. The scene reads the surface behind it, so the light adds up on a dark page and tints a light one, and the near hills slide a little with the pointer.
Use it under the copy of a hero, at the foot of a pricing section or along the bottom of a card. For thick blurred bands that cross through the box, use Wavy; for curtains of light with rays that hang from the top, Aurora; for solid ridgelines in haze with a low sun, Dunes. With reduced motion it holds one still frame.


Installation
Usage
<script lang="ts">
import { LightWaves } from "@/components/ui/light-waves";
</script>
<LightWaves class="flex min-h-[36rem] flex-col items-center pt-20">
<h1 class="text-5xl font-semibold">Fall asleep before the story ends</h1>
</LightWaves>
Light Waves is a container: whatever you put inside sits on top of the hills, in normal flow. It fills its own box, so give it a height or content. The farthest hill reaches height of the box (half of it by default), so the upper part stays plain for copy. For a backdrop behind the whole page, render it empty with className="fixed inset-0 -z-10".
Presets
<LightWaves /><LightWaves
colors={["#bbf7d0", "#34d399", "#10b981", "#0d9488"]}
placement="top"
/><LightWaves
colors={["#fde68a", "#fb923c", "#f43f5e", "#9f1239"]}
height={0.6}
layers={6}
/><LightWaves
colors={["#f5d0fe", "#c084fc", "#818cf8"]}
fill={0.5}
layers={4}
softness={1}
speed={0.7}
/><LightWaves
colors={["var(--foreground)", "var(--muted-foreground)"]}
fill={0}
intensity={0.5}
/><LightWaves
amplitude={1.6}
angle={10}
frequency={1.6}
height={0.7}
layers={8}
/><LightWaves fill={0} layers={7} reach={0.8} softness={0.05} />Each preset is a set of props, so copy one and keep tuning. Lagoon is the default. Veil drops the fill and sharpens the crests, so seven thin sheets of light overlap. Mist does the opposite: four fully feathered hills that read as haze. Canopy hangs the hills from the top edge, and Mono takes its two colors from your theme.
Examples
Hero
The hills fill the lower half of the box and the copy sits above them on the plain surface, with no prop set. The farthest crest stops just under the buttons; the chip and the second button have a translucent ground of their own for the frames where it rises behind them.
Colors
colors runs from the crest of a hill down into it: here pale amber on the crests, through orange and rose, to deep crimson, on a dark surface. layers={6} and height={0.6} stack one more hill and raise the farthest one.
In a card
Seven sheets with no fill (fill={0}), clean crests (softness={0.05}) and a long glow (reach={0.8}) along the bottom of a 24rem card. The hills scale with the box; the hairline on each crest stays about three CSS pixels wide. The title and the line under it sit at the top, clear of the light.
Customization
Every color is a CSS color, so a theme variable works and follows a theme switch: colors={["var(--chart-1)", "var(--chart-2)", "var(--chart-3)"]}. Put the lightest color first: it lands on the crests, and the last one fills the depths. fill, reach and softness shape a single hill, layers, height and depth shape the stack, and amplitude, frequency and angle shape the ground they stand on.
The surface is the root's own background, bg-background by default. Give the root another (bg-slate-950, bg-sky-50) and the hills adapt: they add light to a dark surface and tint a light one, and the far hills fade toward whichever it is. fade masks an edge, opacity turns the whole effect down, and grain adds film grain.
<LightWaves
class="min-h-[32rem] bg-slate-950"
colors={["var(--chart-1)", "var(--chart-2)", "var(--chart-3)"]}
fade="left"
fill={0}
layers={7}
/>
Performance
It's one WebGL2 canvas and one fragment shader with no noise in it: three sines and three cosines a hill, eight hills at most, and one OKLab color mix for each hill that covers the pixel. Pixels above every crest skip the color work. 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 hills are decoration: the canvas is 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.
Copy above the hills sits on the plain surface and keeps its full contrast. Over the hills of the default look, text in text-foreground measures 10.4:1 at the worst spot on a light surface, so it reads anywhere. On a dark surface the crests are the bright part: 2.9:1 in the glow under a crest and 2.1:1 on the hairline itself, both under the 4.5:1 body text needs. Keep copy above the hills there, lower intensity, or give it a ground of its own.
FAQ
How do I change the colors?
Pass two to eight CSS colors to colors, lightest first. The first lands on the crests and the last fills the depths of each hill, with the rest spread between. Hex, oklch() and theme variables such as var(--chart-1) all work, and a variable follows your theme when it changes.
Does it work on a light page?
Yes, with no prop to set. The scene reads the color behind it. On a light surface each hill is a tint, strongest under its crest, and the far hills are the palest. On a dark surface each hill is light, the crests glow, and the far hills are the deepest. Set the surface with a class on the component, such as bg-slate-950.
Can I get flat layered waves, with no gradient?
Yes: fill={1} keeps every hill evenly lit from its crest to the bottom edge, and softness={0} cuts the crests clean. That's the layered-wave footer many sites use, still animated and still translucent. Lower intensity if the stack gets too solid at the bottom.
Can the hills hang from the top?
placement="top" turns the scene over, so the hills hang from the top edge and the lower part of the box stays plain. It suits a page header or the top of a card. angle slopes the ground they stand on by up to 30 degrees either way.
How do I put it behind the whole page?
Render it empty with className="fixed inset-0 -z-10". It still follows the pointer there, since it listens on the window. To put it behind one section, wrap that section's content in it and give it a height, such as min-h-svh.
Will it slow my page down?
No noise is sampled: a hill costs six trigonometric calls and, where it covers the pixel, one color mix. The GPU does all of it, and nothing runs while the box is off screen or the tab is hidden. If a device can't keep up, the scene renders fewer pixels by itself. quality={0.75} draws a little over half the pixels.
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.
API Reference
LightWaves
data-slot="light-waves"
amplitude?number
How far each hill's crest swings up and down.
- Default
1
angle?number
The slope of the ground the hills stand on, in degrees from -30 to 30: positive raises the right side.
- Default
0
colors?string[]
Two to eight CSS colors, from the crest of a hill down into it, the
lightest first. Theme variables such as var(--chart-1) follow your
theme.
- Default
["#67e8f9", "#22d3ee", "#3b82f6", "#4f46e5"]
depth?number
How much the hills differ with distance, from 0 (all alike) to 1 (the far ones dim, small and slow).
- Default
0.7
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
How much of a hill stays lit below the glow of its crest, from 0 (only the crest glows) to 1 (an even fill).
- Default
0.15
frequency?number
How many swells a hill makes across the box: higher packs more of them.
- Default
1
grain?number
Film grain over the scene, from 0 to 1.
- Default
0
height?number
How high the farthest hill reaches, from 0.1 to 1 of the box.
- Default
0.5
intensity?number
How strongly the light shows.
- 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
layers?number
How many hills stand one behind the other, from 2 to 8.
- Default
5
opacity?number
How strongly the scene shows over the surface, from 0 to 1.
- Default
1
paused?boolean
Holds the current frame.
- Default
false
placement?"bottom" | "top"
Which edge the hills stand on: bottom raises them from below, top
hangs them from above.
- Type
"bottom" | "top"- Default
"bottom"
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 below its crest a hill's glow reaches, from 0.1 to 1 of its own height.
- Default
0.6
seed?number
Another arrangement of the same hills, from 0 to 20.
- Default
0
softness?number
How soft each crest is, from 0 (a clean edge) to 1 (a wide feather).
- Default
0.1
speed?number
Animation speed: 1 is normal, 0 holds the frame.
- Default
1
time?number
A fixed moment, in seconds: draws it and doesn't animate.











