shadcn.io is not affiliated with official shadcn/ui
Snow falls over a soft winter sky. Near flakes are bigger, brighter and faster and sway as they fall; a far layer of tiny flakes drifts behind them, so the snowfall has depth. The flakes are laid out from their index when the page renders and moved by keyframes the install adds to your stylesheet, so no JavaScript runs while it snows.
Use it for a seasonal launch, a holiday card or a winter hero. For fast streaks and optional lightning use Rain; for golden motes drifting through a shaft of sunlight, Pollen; for the same fall in colour, Confetti.
Installation
Usage
import { Snow } from "@/components/ui/snow";<Snow className="min-h-[420px]">
<h1>Let it snow</h1>
</Snow>Snow is a container: put your content inside and the snow falls behind it. It fills the box you give it, so set its height (min-h-[420px]), or className="fixed inset-0 -z-10" to cover the whole page.
Demos
Night sky
skyColor sets the top of the sky; toward the ground it takes a faint haze of the flakes' colour. A dark blue sky with white flakes stays the same night in light and dark mode.
Blizzard
count is how many near flakes fall at once (80, up to 150), wind how far a flake drifts sideways for each height it falls, and speed multiplies every fall. Together they turn a quiet snowfall into a storm.
Accessibility
The snow is decoration: the whole layer is hidden from screen readers and ignores the pointer, and your content inside reads as usual. With reduced motion every flake stops where it is, so the box shows a still snowfield on its sky rather than an empty one. Nothing flashes.
In light mode the default sky is an overcast grey, so white flakes show. Text in the foreground colour stays above 10:1 on it, but muted text falls under 3:1 near the top: keep body text in text-foreground, or set skyColor to a lighter or darker sky.
FAQ
How does the depth work?
Each near flake's depth comes from its index and sets its size, brightness, speed and sway. Behind them, two far layers of tiny flakes are repeating SVG patterns that drift down slowly, the nearer one a little faster.
Can I add wind?
wind is how far a flake moves sideways for each height it falls: 0.15 (the default) is 15%, a negative number blows left and 0 falls straight down. The far layers lean to match.
How do I make it heavier or lighter?
count sets the near flakes (80 by default, up to 150) and speed scales every fall. For a blizzard try count={150} wind={0.4} speed={1.6}; for a few slow flakes, count={30} speed={0.6}.
Does it work in light mode?
Yes: it paints an overcast grey sky so white flakes show. Set skyColor="transparent" to snow over your own background, and flakeColor if that background is light.
Is the speed the same in a small card?
Yes: flakes fall at a set number of pixels per second, so a card and a full page snow at the same pace, and a short card is crossed sooner. Lower speed for a calmer card.
API Reference
Snow
<div> data-slot="snow"
count?number
How many near flakes fall at once, from 0 to 150. The far flakes are a repeating pattern behind them, so they fill any size of box.
- Default
80
flakeColor?string
The flakes' colour, any CSS colour.
- Default
"var(--background)" in light mode, "var(--foreground)" in dark
skyColor?string
The colour at the top of the sky, any CSS colour; toward the ground it
takes a faint haze of the flakes' colour. "transparent" drops it, to
snow over a photo or your own background.
- Default
an overcast grey in light mode, the page's background in dark
speed?number
How fast it falls, as a multiplier: 0.5 is slow, 2 is a flurry. @default 1.
wind?number
How far a flake drifts sideways for each height it falls: 0.15 is 15%, a negative number blows left, 0 falls straight down.
- Default
0.15
render?ReactElement | ((props: object, state: object) => ReactElement)
Replace the host element or compose it with another component.
- Type
ReactElement | ((props: object, state: object) => ReactElement)
className?string
Merged with the part's classes.
--snow-colorstring
The flakes' colour (--background in light mode, --foreground in dark).
--snow-groundstring
The bottom of the sky (the sky with a 12% haze of the flakes' colour).
--snow-skystring
The top of the sky (an overcast grey in light mode, --background in dark).
--snow-speedstring
How fast it falls, a multiplier (1).
--snow-windstring
Sideways drift per height fallen (0.15).
Related
- Pro


Rain Background
WeatherThe same sky, with fast streaks and optional lightning


Fog Background
WeatherLayer it under snow for a winter haze
- Pro


Pollen Background
ParticlesThe same depth layers, golden motes drifting in a sunbeam
- Pro


Confetti Background
ParticlesThe same fall, sway and spin in colour, for celebrations


Starfield Background
SpaceDots on a dark sky that fly toward you instead of falling
- Pro


Fireflies Background
ParticlesWarm glowing points for summer nights instead of winter