Rain on Glass
Droplets sliding down glass over neon bokeh.
Nobody's in a hurry tonight
Last train at 01:52
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/rain-glass.jsonUsage
import { RainGlass } from "@/components/ui/rain-glass"
<section className="relative overflow-hidden bg-[#05060a]">
<RainGlass />
<h1 className="relative">Nobody's in a hurry tonight</h1>
</section>Examples
Drizzle to downpour
intensity sets how fast beads land and drops form.
Wipe the glass
With wipe, moving the pointer over the glass clears a path through the drops. Rain fills it back in.
Over your own scene
Turn bokeh off and the glass is transparent: put anything behind it. Here a blurred NeonText sign hangs in the window.
API reference
Two canvases that fill the nearest positioned parent: the lights behind the glass at half resolution, and the water on it at full resolution. Accepts native div attributes.
| Prop | Type | Default |
|---|---|---|
color | NeonColorMain color of the lights behind the glass and of the light caught in each drop. Amber streetlights and red tail lights mix in. | inherited |
intensity | numberHow hard it's raining, 0 to 1. | 0.5 |
bokeh | booleanOut-of-focus lights behind the glass, with passing traffic. Off leaves the glass transparent over your own background. | true |
speed | numberSpeed multiplier for the drops and the traffic. 0 freezes the frame. | 1 |
wipe | booleanMoving the pointer over the glass wipes the water away. | false |
Accessibility
- Decorative: rendered with aria-hidden and pointer-events: none. Wiping listens on the window, so content on top stays clickable.
- Thousands of tiny beads live in two bitmaps, not as objects; only the few dozen larger drops are simulated. Drop shading is drawn once and stamped.
- The first frame is already wet: a few seconds of weather run before anything is drawn. That's also the still frame you get under prefers-reduced-motion.
- It caps the pixel ratio at 2 and stops drawing offscreen and in hidden tabs.