shadcn.io is an independent project built on shadcn/ui
Drops Background for Svelte
Raindrops on still water: rings spread, cross and fade. For Svelte with Ark UI, when a wellness or reading page should feel calm.
On this page10 sections
Drops land on still water at changing places, and each sends out a few rings that spread, cross the others and fade. It's a GLSL scene on WebGL2 with no dependency. Every ring is shaded as a ripple, bright on the side that faces the light and deeper in color on the other, over a faint tint of the water that two slow swells gather and thin. The water is seen at a tilt, so rings are smaller and flatter toward the top of the box. It reads on a light surface and on a dark one.
Use it behind a wellness, meditation or reading page, or any hero that should feel calm. For one set of rings that pulses from a single point, use Ripple; for the rain itself falling, Rain; for light dancing under the surface, Caustics. With reduced motion it holds one frame of rings.


Installation
Usage
<script lang="ts">
import { Drops } from "@/components/ui/drops";
</script>
<Drops class="flex min-h-[32rem] flex-col items-center justify-center">
<h1 class="text-5xl font-semibold">Ten quiet minutes, every evening</h1>
</Drops>
Drops is a container: whatever you put inside sits on top of the water, 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"; a press still adds a drop there.
Presets
<Drops /><Drops
angle={60}
color="#ea580c"
intensity={1.5}
lightColor="#fde68a"
swell={0.7}
tilt={0.7}
/><Drops color="#14b8a6" lightColor="#ecfeff" tilt={0.8} /><Drops
color="#6366f1"
frequency={2}
lightColor="#e0e7ff"
swell={0.8}
tint={0.8}
/><Drops
damping={0.7}
frequency={6}
lineWidth={6}
rings={2}
size={110}
tilt={0.75}
/><Drops
damping={0.25}
frequency={0.8}
lineWidth={12}
rings={5}
size={320}
swell={0.2}
/><Drops
color="var(--foreground)"
lightColor="var(--background)"
rings={4}
swell={0}
tilt={0}
tint={0.2}
/>Each preset is a set of props, so copy one and keep tuning. Pond is the default. Rain is many small drops with two rings each, Still is a slow drop with five wide rings, Dusk and Night change the water and the light, and Zen draws the rings from straight above in your theme's foreground color.
Examples
Hero
The default look behind a headline: the rings are thin and pale enough for the copy to sit on them, so nothing is set.
Dusk
Warm water on a dark surface: color="#ea580c" for the water, lightColor="#fde68a" for the lit side of each ring, the light moved to the upper right with angle={60}, a lower view (tilt={0.7}), a stronger swell, and intensity={1.5} so the rings glow.
In a card
Smaller rings for a small box: size={130} and lineWidth={7}, with four drops a second, since the drops are shared out over the whole box.
Customization
color is the water (its tint and the shaded side of each ring) and lightColor is the lit side and the splash. Both take any CSS color, theme variables included, and follow a theme switch: color="var(--foreground)" with lightColor="var(--background)" gives ink rings on any theme. angle moves the light, so it decides which side of a ring is bright.
The surface is the root's own background, bg-background by default: give the root another (bg-stone-950) and the water sits on it. frequency, size, rings and lineWidth shape the drops, in pixels at the bottom edge of the box; tilt sets how low the water is seen from, and tint and swell how much of its color lies between the rings. fade, grain and opacity fit it into a layout.
<Drops
class="min-h-[32rem]"
color="var(--chart-2)"
fade="top"
frequency={2}
tilt={0.8}
tint={0.3}
/>
Performance
It's one WebGL2 canvas and one fragment shader, with no simulation and no noise: every pixel goes through 16 drops and up to 4 presses and skips the ones whose rings don't reach it, so most pixels do a few lines of arithmetic. 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 water is decoration: it's hidden from assistive tech and lets every click through to your content. With reduced motion it draws one frame of rings and ignores presses. A ring takes about three seconds to spread and fade, and a splash is a point a few pixels wide, so nothing flashes.
At intensity 1 and below, the scene holds the rings pale enough on a light surface and soft enough on a dark one for copy in the foreground color: the worst pixel of the default look measured 8.1:1 under dark text and 4.9:1 under light text.
FAQ
How do I change the colors?
Set color for the water and lightColor for the bright side of the rings. The water's color shows as a faint tint over the whole box and as the shaded side of each ring; the light's color shows where a ring faces the light and at the splash. Any CSS color works, and a theme variable follows your theme.
Can I remove the tint over the whole box?
Yes: tint={0} leaves only the rings on your surface, and swell={0} keeps the tint even. At the default, the tint covers about 2% to 5% of a light surface, more toward the top, where the water is seen from lower.
Can the rings be round, seen from above?
Yes: tilt={0} looks straight down, so every ring is a circle and they're all one size. At 1 the water is seen from low, with flat rings that get smaller toward the top. The default is 0.5.
What do the pointer and a press do?
A press adds a drop where you click, a little heavier than the rain's. The pointer trails small rings as it moves over the water. Presses on links, buttons and fields don't add drops, touch never does, and interactive={false} turns both off.
Does it work on a light page?
Yes, with no prop to set. On a light surface the shaded side of each ring is drawn in the water's color and the lit side is left as bare surface; on a dark one the lit side glows in lightColor. Set the surface with a class on the component, such as bg-slate-950.
How do I put it behind the whole page?
Render it empty with className="fixed inset-0 -z-10". The sizes are in pixels, so a large page shows more water with rings of the same size, not larger rings. Raise frequency a little for a very large page, since the drops are shared out over the whole box.
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.
How is it different from Ripple?
Ripple is one set of concentric rings that pulses from a fixed point, a graphic device. Drops is a water surface: many drops at changing places, rings that cross, shading with a light side and a dark side, and a view at a tilt.
API Reference
Drops
data-slot="drops"
angle?number
Where the light comes from, in degrees: 0 is the right, 90 the top. It decides which side of a ring is lit.
- Default
120
color?string
The CSS color of the water: its faint tint, and the shaded side of
every ring. A theme variable such as var(--primary) works.
- Default
"#0ea5e9"
damping?number
How quickly a ring loses its height as it spreads, from 0 to 1.
- Default
0.5
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.
frequency?number
Drops a second, from 0.5 to 6.
- Default
3
grain?number
Film grain over the scene, from 0 to 1.
- Default
0
intensity?number
How strong the rings are, from 0 to 2. Up to 1 the lit side stays soft enough on a dark surface for copy to read on it.
- 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
lightColor?string
The CSS color of the lit side of a ring and of the splash.
- Default
"#ffffff"
lineWidth?number
The width of one ring, in pixels, at the bottom edge of the box.
- Default
9
opacity?number
How strongly the scene shows over the surface, from 0 to 1.
- Default
1
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
rings?number
How many rings a drop sends out, from 1 to 6.
- Default
3
seed?number
Another pattern of drops, from 0 to 20.
- Default
0
size?number
How far a ring travels before it's gone, in pixels at the bottom edge.
- Default
200
speed?number
Animation speed: 1 is normal, 0 holds the frame.
- Default
1
swell?number
How much the water moves between drops, from 0 (a mirror) to 1: two long, slow swells cross it and gather its tint.
- Default
0.4
tilt?number
How low the water is seen from, from 0 (straight down: round rings of one size) to 1 (across it: flat rings, smaller toward the top).
- Default
0.5
time?number
A fixed moment, in seconds: draws it and doesn't animate.
tint?number
How much of the water's color lies over the whole surface, from 0 to 1.
- Default
0.5











