shadcn.io is an independent project built on shadcn/ui
Meteors Background for Vue
A meteor shower: streaks with bright heads and fading tails over faint stars. For Vue with Ark UI, when a night sky needs motion.
On this page10 sections
A meteor shower crosses the box at one angle. Each streak has a bright head and a tail that thins and fades along its length; it lights up, draws its tail out and burns away, then another starts somewhere new after its own wait, so no two are in step. They fly at three distances over faint twinkling stars and a soft glow along the bottom edge. It's a GLSL scene on WebGL2 with no dependency. Heads and stars are light on a dark surface and ink on a light one.
Use it behind a hero, a launch page or a card with a night-sky mood. For a quiet sky that one long trail crosses now and then, use Shooting Stars; for stars in depth with no streaks, Starfield; for the same slant as weather, Rain. With reduced motion it holds one still frame.


Installation
Usage
<script setup lang="ts">
import { Meteors } from "@/components/ui/meteors";
</script>
<template>
<Meteors class="flex min-h-[32rem] flex-col items-center justify-center">
<h1 class="text-5xl font-semibold">Know which nights to stay up for</h1>
</Meteors>
</template>
Meteors 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
<Meteors /><Meteors
:count="6"
:depth="0.3"
:glow="1"
:length="420"
:speed="0.5"
:width="4"
/><Meteors
:angle="-165"
color="#ffe9c7"
:count="14"
:haze="1"
:stars="0.3"
tailColor="#ff8fb1"
/><Meteors
:angle="-128"
color="#fff1d6"
:count="12"
:glow="1"
:length="280"
tailColor="#ff7a3d"
:width="3"
/><Meteors :glow="0.3" :haze="0" tailColor="var(--foreground)" /><Meteors
:count="36"
:depth="1"
:length="160"
:spread="1"
:width="1.5"
/>Each preset is a set of props, so copy one and keep tuning. Shower is the default. Storm packs 36 short, thin streaks at full depth; Comets slows 6 long, wide ones to half speed with a full glow; Ember turns them steep and warm; Dawn flattens the angle over a pink glow; and Mono takes both colors from your theme, with no glow along the bottom.
Examples
Hero
The streaks are a pixel or two wide and the sky between them is plain, so the hero is centered on it with no props set. The headline and the line under it use the foreground color; the chip and the second button have a translucent ground of their own.
Colors
color is the head and tailColor what the tail fades through: here a pale gold head and an orange tail on a dark surface, at a steeper angle={-128}, with longer and wider streaks (length={280}, width={3}) and glow={1}.
In a card
count is how many meteors are in flight in a 1280 by 720 box, so a card shows a share of them. Here count={32} keeps three or four in a small card, with shorter tails (length={120}) and more stars (stars={0.9}).
Customization
color and tailColor take any CSS color, so a theme variable works and follows a theme switch. The default color is var(--foreground): white heads and stars in a dark theme, dark ones in a light theme, with a blue tail in both. If a color comes too close to the surface to show, the scene shifts its lightness so the streaks stay visible. angle is the way they fly: -90 is straight down, -152 (the default) down and to the left, -28 down and to the right.
The surface is the root's own background, bg-background by default. Give the root another (bg-slate-950, a gradient) and the sky adapts: light adds to a dark surface and tints a light one. fade masks an edge, opacity turns the whole effect down, and grain adds film grain.
<template>
<Meteors
class="min-h-[32rem] bg-slate-950"
color="var(--chart-1)"
fade="bottom"
:haze=0
tailColor="var(--chart-2)"
/>
</template>
Performance
It's one WebGL2 canvas and one fragment shader. The shower is three sets of lanes, one for each distance, and a pixel looks at the three lanes nearest to it in each, so it weighs nine meteors at most and skips the lanes and meteors too far to reach it, plus two star cells and one sample of simplex noise for the glow. No loop grows with count: more meteors means narrower lanes, not more work. 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 shower is decoration: it's hidden from assistive tech and lets every click through to your content. With reduced motion it draws one still frame of meteors in flight and ignores presses. Nothing flashes: a meteor takes about 0.4 seconds to light up and 1.6 seconds to burn away, and a star takes 3 seconds or more to dim and come back.
Use the foreground color (text-foreground) for copy on top. Measured on the default frame, the mean contrast of foreground text is 19:1 on the default light theme and 18:1 on the dark one, and no 24-pixel block averages below 13:1. Only the cores of the streaks and the brightest stars fall under 4.5:1, about 0.1% of the pixels on dark and under 0.1% on light, each a line 1 to 2 pixels wide that is gone within 3 seconds. For long body text, lower count or glow.
FAQ
How do I change the colors?
color sets the heads and the stars, and tailColor the color the tails fade through, the light around each head and the glow along the bottom edge. Both take hex, oklch() and theme variables such as var(--primary), and a variable follows your theme when it changes. Set both to the same value for a shower in one color.
How do I change the direction they fall?
angle is the way they fly, in degrees: 0 is to the right, -90 straight down, 180 to the left. The default is -152, a shallow slant down and to the left; -28 mirrors it. spread sets how much the three distances and each meteor differ from that angle, up to a few degrees, so the streaks don't look ruled.
How many meteors does it show?
count is the average number in flight at once in a 1280 by 720 box, 16 by default, from 2 to 40. About half are far away: short, thin and faint. A card or a phone shows a share of them at the same spacing, so raise count for a small box. Each flies for 3.2 seconds and its lane then waits 6 to 13 seconds.
How is this different from the Rain background?
Rain is many thin streaks that fall steeply through the whole box at once. Meteors are few: each has a bright head, a tail that fades to nothing, a start and an end inside the box, and its own timing. For one long trail every few seconds over a still sky, use Shooting Stars.
Does it react to the pointer?
A press on the background launches one meteor from that point, along angle. Moving the pointer does nothing, and a press on a link, a button or a field over it is left alone. interactive={false} turns it off.
Does it work on a light page?
Yes, with no prop to set. On a white page the heads are dark ink, the tails fade through tailColor, the stars are small tinted points and the glow along the bottom is a pale wash. On a dark page the same scene adds light. Set the surface with a class on the component, such as bg-slate-950.
How do I put it behind the whole page?
Render it empty with className="fixed inset-0 -z-10". A press still launches a meteor 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.
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.
API Reference
Meteors
data-slot="meteors"
angle?number
The way the meteors fly, in degrees: 0 is to the right, 90 up, 180 to the left, -90 straight down.
- Default
-152
color?string
The color of the meteors' heads and of the stars, any CSS color. The default follows your theme: light on a dark surface, dark on a light one.
- Default
"var(--foreground)"
count?number
How many meteors are in flight at once in a 1280 by 720 box, on average. A smaller box shows fewer, at the same spacing.
- Default
16
depth?number
How far apart the three distances feel, from 0 (every meteor alike) to 1 (far ones short, thin, faint and slow).
- Default
0.75
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.
glow?number
How much light spreads around each head and along its tail, from 0 to 1.
- Default
0.6
grain?number
Film grain over the scene, from 0 to 1.
- Default
0
haze?number
How strongly the glow along the bottom edge shows, in tailColor, from
0 to 1.
- Default
0.5
intensity?number
How bright the meteors, the stars and the glow are.
- Default
1
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
The length of the nearest meteors' tails in pixels.
- Default
240
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 the three distances differ in angle, from 0 (all parallel) to 1 (a few degrees apart, as if they came from one point in the sky).
- Default
0.5
stars?number
How many stars sit behind the shower and how bright they are, from 0 (none) to 1.
- Default
0.6
tailColor?string
The color the tails fade through, any CSS color.
- Default
"#6d8bff"
time?number
A fixed moment, in seconds: draws it and doesn't animate.
width?number
The width of the nearest meteors at the head, in pixels.
- Default
2











