Shooting stars streaking across a dotted sky at scattered times.
Thin grid lines with streaks of light falling down them at scattered times.
Customize
Usage
import { LightBeams } from "@/components/motionkit/light-beams";
<LightBeams className="h-96 rounded-3xl">
<h1>Version 2.0</h1>
</LightBeams>Motion
The exact curves this component runs, plotted with Motion's own maths.
Beam fall
Runs on its own
Developer and infrastructure product heroes, data and speed themes.
Thin vertical grid lines carry short gradient streaks that fall from top to bottom on a loop. Fixed pseudo-random delays and offsets scatter them, while rendering identically on the server and in the browser, and the top and bottom edges fade so beams appear and vanish softly.
Works in the App Router as is. Requires Tailwind CSS v4.
One command adds the file and installs its dependencies. Needs a components.json (run npx shadcn@latest init once if you don't have one).
npx shadcn@latest add https://www.motionkitui.com/r/light-beams.jsonnpm install motionSave as components/motionkit/light-beams.tsx.
"use client";
import type { ReactNode } from "react";
import { motion, useReducedMotion } from "motion/react";
type LightBeamsProps = {
children?: ReactNode;
/** Number of vertical lines. */
count?: number;
/** Seconds for a beam to fall the full height. */
duration?: number;
/** Colour of the falling light. */
color?: string;
className?: string;
};
// fixed pseudo-random offsets so beams look scattered but render identically on server and client
const scatter = (index: number) => ((index * 7919) % 100) / 100;
export function LightBeams({ children, count = 9, duration = 3.2, color = "#5FAEB4", className = "" }: LightBeamsProps) {
const reduceMotion = useReducedMotion();
return (
<div className={`relative isolate overflow-hidden bg-[#0C1010] ${className}`}>
<div aria-hidden className="absolute inset-0 -z-10 flex justify-evenly">
{Array.from({ length: count }, (_, index) => (
<div key={index} className="relative h-full w-px bg-white/[0.06]">
{!reduceMotion && (
<motion.span
className="absolute -left-px h-24 w-[3px] rounded-full"
style={{ background: `linear-gradient(to bottom, transparent, ${color})`, boxShadow: `0 0 12px ${color}` }}
initial={{ top: "-25%" }}
animate={{ top: "110%" }}
transition={{
duration: duration * (0.8 + scatter(index) * 0.6),
delay: scatter(index + 3) * duration,
repeat: Infinity,
repeatDelay: scatter(index + 5) * duration,
ease: "easeIn",
}}
/>
)}
</div>
))}
</div>
{/* fade the top and bottom so beams appear and vanish softly */}
<div aria-hidden className="absolute inset-0 -z-10 bg-[linear-gradient(to_bottom,#0C1010,transparent_25%,transparent_75%,#0C1010)]" />
{children}
</div>
);
}
| Prop | Type | Default | Description |
|---|---|---|---|
| count | number | 9 | Number of vertical lines. |
| duration | number | 3.2 | Seconds for a beam to fall the full height. |
| color | string | "#5FAEB4" | Colour of the falling light. |
How we audit: the WCAG 2.2 animation checklist and respecting reduced motion in React.
Yes. The file starts with "use client", so you can import it straight into a Server Component page or layout. It works in Vite as is, and in Astro as a React island.
Only the motion package, beside React and Tailwind CSS v4. There is no MotionKit package and no Tailwind config to add.
Yes. Run npx shadcn@latest add https://www.motionkitui.com/r/light-beams.json in any project with a components.json. It saves the file to components/motionkit and installs its dependencies.
Beams are removed for reduced-motion users, leaving the static lines. It loops forever otherwise, so if it sits beside other content for more than 5 seconds, WCAG 2.2.2 asks you to add a pause control.
Shooting stars streaking across a dotted sky at scattered times.
Dozens of fine lines flowing like a length of silk in two colours, parting gently around the pointer.
A ribbon woven from dozens of fine threads of spectral light, gathering into a bright seam where it turns side-on and fanning into a veil of colour.
Now shipping