Columns of code characters raining down, each led by a brighter glyph and fading into the dark. A calmer, on-brand take on code rain.
A rainy window at night: city lights glow out of focus beyond it, drops gather and run, and each one is a tiny lens holding the lights upside down. Drag to wipe the glass.
Stay in tonight
Customize
Usage
import { RainGlass } from "@/components/motionkit/rain-glass";
<RainGlass
className="h-[32rem] rounded-3xl"
>
<h1>Your hero</h1>
</RainGlass>Motion
The exact curves this component runs, plotted with Motion's own maths.
Drops run
Runs on its own
Moody film, music and fiction sites, cafés and cosy brands, autumn campaigns, and night-time or rainy-day hero sections.
The view beyond the window is painted once per size: a dark sky and a few hundred soft lights, gathering towards the bottom like a city. It's kept twice, heavily blurred for the window and sharp for the drops. Each drop is clipped to an ellipse and filled with a shrunken, upside-down slice of the sharp view, the way a real droplet works as a lens, then given a dark lower rim and a glint. New droplets keep landing; big ones eventually run in fits and starts, swallowing smaller ones in their path, growing and leaving beads behind. Wiping clears every drop under the pointer.
| Prop | Type | Default | Description |
|---|---|---|---|
| lights | string[] | ["#F2B8A2", "#E9C46A", "#5FAEB4", "#D0607A", "#F6F1E8"] | Colours of the lights beyond the glass. |
| background | string | "#0B0E14" | The night behind the lights. |
| rain | number | 1 | How hard it's raining, 0 to 2. |
| interactive | boolean | true | Let the pointer wipe a path through the drops. |
| children | ReactNode | — | Your content, layered above. |
How we audit: the WCAG 2.2 animation checklist and respecting reduced motion in React.
Yes. The file starts with "use client", so you can import it straight into a Server Component page or layout. It works in Vite as is, and in Astro as a React island.
Nothing beyond React and Tailwind CSS v4. There is no MotionKit package and no Tailwind config to add.
Yes, with MotionKit Plus. Add the @motionkit registry and your personal token to components.json (the snippet is on your account page), then run npx shadcn@latest add @motionkit/rain-glass. It saves the file to components/motionkit and installs its dependencies.
Rain on Glass is part of MotionKit Plus (£12 / $15 / €14 a month or £96 / $120 / €112 a year). The live preview and playground are free to explore; Plus unlocks its source code, every customisation control and commercial use.
With reduced motion on, the drops are drawn once and stay put, though you can still wipe them away.
Columns of code characters raining down, each led by a brighter glyph and fading into the dark. A calmer, on-brand take on code rain.
A field of tiny squares that flicker softly, drawn on a canvas so it stays light.
A soft ribbon of light behind the pointer, across the window or inside one section.
The live preview is free to explore. Plus unlocks the source for Rain on Glass and every other premium component.
Not ready for Plus? A free account unlocks 4 premium components, Depth Card, Rolling Text, Dot Wave and Confetti Button, with no card needed.
Customize
Usage
import { RainGlass } from "@/components/motionkit/rain-glass";
<RainGlass
className="h-[32rem] rounded-3xl"
>
<h1>Your hero</h1>
</RainGlass>Motion
The exact curves this component runs, plotted with Motion's own maths.
Drops run
Runs on its own
Stay in tonight