Meteors Effect for React
Meteors is a React effect that sends occasional streaks of light across a card or section background. Use it for quiet depth; each streak moves by transform and opacity only and stays still under reduced motion.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/meteors.jsonShip the quiet details
A streak crosses now and then, never twice at once.
On a glass card
Meteors fills its relative parent, takes the parent's corner radius and clips to it. Put it before the content so the text sits above the streaks, and keep count low: a long interval is what keeps it occasional.
Ship the quiet details
A streak crosses now and then, never twice at once.
import { useState } from "react";
import { Badge } from "@/components/sheenui/badge/badge";
import { GlassCard } from "@/components/sheenui/glass-card/glass-card";
import { Meteors } from "@/components/sheenui/meteors/meteors";
import { Switch } from "@/components/sheenui/switch/switch";
// Package build (after the first npm release, or a packed tarball): import { Badge, GlassCard, Meteors, Switch } from "@sheenui/theme";
// This example also uses badge, glass-card, switch: npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/badge.json https://lokendra-builds.github.io/sheenui/r/glass-card.json https://lokendra-builds.github.io/sheenui/r/switch.json
export function Example() {
const [paused, setPaused] = useState(false);
return (
<>
<Switch label="Pause" checked={paused} onCheckedChange={setPaused} />
<GlassCard className="relative w-full max-w-sm overflow-hidden p-8">
<Meteors count={8} paused={paused} />
<Badge className="relative">Launch week</Badge>
<h2 className="relative mt-3 text-xl font-semibold">Ship the quiet details</h2>
<p className="relative mt-1 text-sm text-sheen-fg-muted">A streak crosses now and then, never twice at once.</p>
</GlassCard>
</>
);
}Files to copy
5 folders · 7 files · 4 packages
- From
theme/src/ components/meteors/lib/{canvas-effects.ts, cn.ts}hooks/{use-media-query.ts, use-preferences.ts}motion/{beat-animations.ts, beat.ts, gate.ts}styles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/meteors.jsonRegistry item: meteors. The styles need the Tailwind v4 glass UI setup.- The examples also use
components/badge/components/glass-card/components/switch/hooks/{use-direction.ts, use-latest.ts}motion/{light-follower.ts, tokens.ts}lib/{field-control-shell.tsx, form.ts, heading.ts, motion-props.ts, state-light.tsx, warn-once.ts}
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/badge.json https://lokendra-builds.github.io/sheenui/r/glass-card.json https://lokendra-builds.github.io/sheenui/r/switch.json- Packages
pnpm add @base-ui/react clsx motion tailwind-merge
Angle, length and rhythm
angle is the direction of travel in degrees clockwise from pointing right (90 is straight down). A shorter interval and more meteors make a shower; keep that for a one-off hero.
A faster shower at 70 degrees.
import { GlassCard } from "@/components/sheenui/glass-card/glass-card";
import { Meteors } from "@/components/sheenui/meteors/meteors";
// Package build (after the first npm release, or a packed tarball): import { GlassCard, Meteors } from "@sheenui/theme";
// This example also uses glass-card: npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/glass-card.json
export function Example() {
return (
<GlassCard className="relative w-full max-w-sm overflow-hidden p-8">
<Meteors count={14} angle={70} length={150} duration={1.2} interval={2.5} />
<p className="relative text-sm">A faster shower at 70 degrees.</p>
</GlassCard>
);
}Props
Keyboard
Accessibility
- Decorative: the layer is aria-hidden. Streaks are thin and fade quickly; use paused where a card sits next to long text (WCAG 2.2.2).
- Reduced motion: nothing flies. Up to four faint still streaks stay as texture.
- Each streak is one element moved by transform and faded by opacity on the compositor, with no blur, mask or filter. They pause off-screen and in hidden tabs.
- The layout is seeded (seed), so the server and the browser render the same streaks and there is no hydration mismatch or layout shift.
When to use the meteors effect
- Use it on a feature card or a section background to add a quiet sense of space, with a streak crossing now and then.
- Tune count, interval and angle: a long interval keeps it occasional, which is what makes it feel premium rather than busy.
- Put it behind glass content so the glass blurs the streaks, or above flat content; it clips to the parent's corner radius.
- Skip it on cards with a lot of text, or use paused; moving light near reading is distracting.
- Pair it with GlassCard, BorderBeam on the same card for a stronger moment, and Badge for a launch label.
Frequently asked questions
Related pages
19 effects pages in all: browse them on All effects.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .