Skip to content

shadcn.io is an independent project built on shadcn/ui

Pro

Shooting Stars Background for Solid

A quiet night sky where one long shooting star crosses every few seconds. For Solid with Ark UI, when a hero needs a calm sky with one event.

On this page10 sections
UI library: Ark UI

A quiet night sky: stars in three sizes twinkle and turn slowly about a far pole, a haze glows off the bottom edge, and every few seconds one long shooting star crosses the upper sky with a bright head, a tapering trail and a wake that lingers. It's a GLSL scene on WebGL2 with no dependency. On a dark surface it's light; on a light one the stars and the trail are drawn in ink over a pale wash. Stars near the pointer shine brighter, and a press sends a shooting star off from that point.

Use it behind a hero, a waitlist page or a card where the sky should stay still most of the time. For a steady shower of short streaks at one angle, use Meteors; for stars in depth with parallax and no streaks, Starfield; for glints that flare and fade in place, Sparkles. With reduced motion it holds one still frame, with a shooting star in mid-flight.

Playground
Shooting Stars Background, still
Customize

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Usage

import { ShootingStars } from "@/components/ui/shooting-stars";
<ShootingStars class="flex min-h-[32rem] flex-col items-center justify-end pb-20">
  <h1 class="text-5xl font-semibold">Sleep through the alerts that can wait</h1>
</ShootingStars>

Shooting Stars is a container: whatever you put inside sits on top of the sky, 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".

Presets

Nightthe default lookTry it
<ShootingStars />
CometTry it
<ShootingStars
  angle={18}
  frequency={0.5}
  hazeColor="#14b8a6"
  length={2}
  lineWidth={3}
  speed={0.5}
  spread={0.1}
  trailColor="#8ff5e1"
/>
DeepTry it
<ShootingStars
  frequency={0.6}
  haze={1}
  hazeColor="#8b3dff"
  starDensity={2.2}
  starSize={2}
  trailColor="#d1a8ff"
  twinkle={1}
/>
DuskTry it
<ShootingStars
  angle={150}
  haze={0.8}
  hazeColor="#e8457f"
  starColor="#fff1dc"
  trailColor="#ffc38a"
/>
MonoTry it
<ShootingStars
  haze={0.3}
  hazeColor="var(--muted-foreground)"
  starColor="var(--foreground)"
  trailColor="var(--muted-foreground)"
/>
PolarTry it
<ShootingStars
  angle={64}
  frequency={1.5}
  hazeColor="#22e584"
  length={0.7}
  spread={0.5}
  starDensity={1.5}
  trailColor="#9dffc8"
/>
Quietthe default lookTry it
<ShootingStars
  frequency={0}
  haze={0.25}
  starDensity={1.6}
  starSize={3.2}
  twinkle={1}
/>

Each preset is a set of props, so copy one and keep tuning. Night is the default. Comet slows the scene to half speed and draws one thick, long streak at a shallow angle. Quiet sets frequency={0} for a sky of large twinkling stars with no shooting stars. Mono takes every color from your theme.

Examples

Hero

The shooting stars cross the upper part of the box, so the copy sits at the bottom, over the haze. The headline and the line under it use the foreground color; the chip and the second button have a translucent ground of their own.

Preview width

Dusk

The Dusk preset on a dark surface: a rose haze (hazeColor, haze={0.8}), warm stars and a peach trail, with angle={150} so the shooting stars fly down to the left.

Preview width

In a card

A small box gets shorter paths by itself. Here frequency={1.5} brings a shooting star more often, length={1.3} stretches its trail and starDensity={1.4} fills the sky a little more.

Preview width

Customization

starColor, trailColor and hazeColor take any CSS color, so a theme variable works and follows a theme switch: starColor="var(--foreground)". On a light surface each color is drawn as an ink of the same hue, dark enough to read on paper, so one set of colors serves both themes.

The surface is the root's own background, bg-background by default. Give the root another (bg-slate-950, bg-indigo-50) and the sky adapts: it adds light to a dark surface and inks a light one. fade masks an edge, opacity turns the whole effect down, and grain adds film grain.

<ShootingStars
  class="min-h-[32rem] bg-slate-950"
  fade="bottom"
  hazeColor="var(--chart-2)"
  starColor="var(--foreground)"
  trailColor="var(--chart-1)"
/>

Performance

It's one WebGL2 canvas and one fragment shader: three hashed grids of stars with one star a cell, six shooting-star slots (two on their own clocks, four for presses), and three samples of simplex noise for the haze. There are no march steps. 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 sky is decoration: it's hidden from assistive tech and lets every click through to your content. With reduced motion it draws one still frame and ignores the pointer.

Text in the foreground color stays above 15:1 over the haze on both surfaces (measured at its strongest, along the bottom edge of the default look). The head of a shooting star is a dot about 3 pixels wide that can pass behind a letter for a moment; the paths stay in the upper part of the box, so put body copy in the lower half. Nothing flashes: a shooting star fades in, crosses in about 2 seconds and fades out, and no more than two cross at once.

FAQ

How do I change the colors?

Three props: starColor for the stars and the head of a shooting star, trailColor for the trail behind it, and hazeColor for the glow off the bottom edge. Each takes any CSS color, including oklch() and theme variables such as var(--primary), and a variable follows your theme when it changes.

How often does a shooting star cross?

At frequency={1}, two slots take turns on periods of 7.3 and 11.3 seconds, so one crosses about every 4 to 5 seconds and the gaps never repeat in a pattern you can spot. Each flight lasts about 2 seconds. frequency={2} halves the periods and frequency={0} leaves only the stars. No more than two cross at once at any setting.

Does it work on a light page?

Yes, with no prop to set. The scene reads the color behind it. On a light surface the stars become ink dots in the hue of starColor, pale for the far ones and dark for the near ones, the trail becomes an ink stroke and the haze a pale wash. Set the surface with a class on the component, such as bg-slate-950.

Can I change the direction they travel?

angle is the direction in degrees: 0 flies to the right, 90 falls straight down, 180 flies to the left. spread is how far each one strays from it, from 0 for parallel paths to 1. The default, angle={32} with spread={0.25}, sends them down to the right at slightly different slopes.

How do I put it behind the whole page?

Render it empty with className="fixed inset-0 -z-10". It still answers the pointer there, since it listens on the window. To put it behind one section, wrap that section's content in it and give it a height, such as min-h-svh.

What does the pointer do?

Stars within about 160 pixels of the pointer shine brighter, and a press on the sky sends a shooting star off from that point along angle. A press on a link, a button or a field inside it does nothing to the sky. interactive={false} turns both off. Touch never moves it, so scrolling on a phone isn't disturbed.

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.

What happens with reduced motion?

It draws one still frame and stops: the full sky with one shooting star in mid-flight, and the pointer no longer changes anything. The frame is the same one every time, so the page looks the same on each visit.

API Reference

ShootingStars

data-slot="shooting-stars"

PropType
angle?number

The direction the shooting stars travel, in degrees: 0 flies to the right, 90 falls straight down, 180 flies to the left.

Default
32
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

How often a shooting star crosses: 1 is one every few seconds, 0 leaves the sky to its stars. Never more than two cross at once.

Default
1
grain?number

Film grain over the scene, from 0 to 1.

Default
0
haze?number

How strongly the haze shows: a glow that rises from the bottom edge and faint dust among the stars, from 0 to 1.

Default
0.5
hazeColor?string

The haze, any CSS color.

Default
"#5a5cff"
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
length?number

How long the trail behind a shooting star is, as a multiplier.

Default
1
lineWidth?number

The trail's thickness at the head, in pixels. It tapers to nothing.

Default
1.6
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
speed?number

Animation speed: 1 is normal, 0 holds the frame.

Default
1
spread?number

How much each shooting star's direction strays from angle, from 0 (all parallel) to 1.

Default
0.25
starColor?string

The stars and the head of a shooting star, any CSS color. On a light surface they're drawn in a dark ink of the same hue.

Default
"#e8eeff"
starDensity?number

How many stars fill the sky, as a multiplier.

Default
1
starSize?number

The width of the brightest stars, in pixels. The others scale with it.

Default
2.6
time?number

A fixed moment, in seconds: draws it and doesn't animate.

trailColor?string

The trail a shooting star leaves, any CSS color.

Default
"#7cc4ff"
twinkle?number

How much the stars twinkle, from 0 (steady) to 1. They change in brightness, never in size.

Default
0.6