A decorative background of meteors falling across their container, each a dot trailing a fading line, drawn in the text colour and hidden under reduced motion.
1
2
3import type { ReactNode } from 'react';
import { Meteors } from '@/registry/bases/base-ui/components/general/meteors';Installation#
pnpm dlx shadcn@latest add @zui/meteorsUsage#
import { Meteors } from '@/components/general/meteors';The meteors fill their nearest positioned ancestor, so place them in a relative box that clips its overflow,
and lift the content over them with relative:
<div className="relative h-64 overflow-hidden rounded-lg border">
<Meteors />
<h2 className="relative">Launch week</h2>
</div>They are decoration: hidden from assistive technology and from the pointer, so nothing they cover stops
taking clicks. A text-* class recolours them.
API reference#
Meteors#
Renders a div and takes every prop a div takes, plus:
| Prop | Type | Default |
|---|---|---|
number | number | 20 |
minDelay | number | 0.2 |
maxDelay | number | 1.2 |
minDuration | number | 2 |
maxDuration | number | 10 |
angle | number | 215 |
Each meteor starts at a random point along the top edge and first falls after a random wait between minDelay
and maxDelay seconds, then falls again every minDuration to maxDuration seconds, a whole number picked once
per meteor. angle is the path's rotation in degrees, as CSS rotate measures it; at 215 a meteor falls to the
right and down. The points are picked after the component mounts, so a server render draws no meteor. Under
prefers-reduced-motion no meteor is drawn. It sets data-slot="meteors" and aria-hidden.