# Rain on Glass

> 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.

Category: Backgrounds · MotionKit Plus · Updated 2026-11-09 · Live demo: https://www.motionkitui.com/components/rain-glass

## When to use it

Moody film, music and fiction sites, cafés and cosy brands, autumn campaigns, and night-time or rainy-day hero sections.

## How it works

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.

## Installation

Part of MotionKit Plus (https://www.motionkitui.com/pricing). Subscribers install it with `npx shadcn@latest add @motionkit/rain-glass` after adding their registry token from https://www.motionkitui.com/account.

## Props

| 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. |

## Accessibility

- **Keyboard: Not applicable.** Decorative, nothing to focus.
- **Screen readers: Pass.** The scene is hidden from assistive tech; only your content is read.
- **Reduced motion: Pass.** With reduced motion on, the drops are drawn once and stay put, though you can still wipe them away.
- **Colour contrast: Pass.** Ivory text measures 17.2:1 on the default night; the lights gather lower down, so headlines sit best near the top.
