# Light Beams

> Thin grid lines with streaks of light falling down them at scattered times.

Category: Backgrounds · Free · Updated 2026-10-20 · Live demo: https://www.motionkitui.com/components/light-beams

## When to use it

Developer and infrastructure product heroes, data and speed themes.

## How it works

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.

## Installation

```bash
npx shadcn@latest add https://www.motionkitui.com/r/light-beams.json
```

Or copy `components/motionkit/light-beams.tsx` below. Requires react, motion and Tailwind CSS v4. Free for personal projects; commercial use needs MotionKit Plus (https://www.motionkitui.com/pricing).

## Props

| 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. |

## Accessibility

- **Keyboard: Not applicable.** A decorative background with nothing to focus.
- **Screen readers: Pass.** The lines and beams are hidden from assistive tech.
- **Reduced motion: Partial.** 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.
- **Colour contrast: Not applicable.** Decorative only. Contrast depends on the content you place on top.

## Source

```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>
  );
}
```
