# Dot Glow Background

> A quiet dot grid that lights up in teal around the pointer.

Category: Backgrounds · Free · Updated 2026-10-20 · Live demo: https://www.motionkitui.com/components/dot-glow-background

## When to use it

Developer-tool heroes, feature sections and dashboards. The homepage of this site uses it.

## How it works

Two dot grids are painted as repeating radial gradients: a faint one everywhere, and a bright teal one above it. The bright grid is masked by a radial gradient centred on the pointer, which eases after it on a spring, so only the dots near the cursor light up.

## Installation

```bash
npx shadcn@latest add https://www.motionkitui.com/r/dot-glow-background.json
```

Or copy `components/motionkit/dot-glow-background.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 |
| --- | --- | --- | --- |
| `gap` | `number` | `20` | Distance between dots in pixels. |
| `radius` | `number` | `180` | Radius of the lit area around the pointer. |

## Accessibility

- **Keyboard: Not applicable.** A decorative background with nothing to focus.
- **Screen readers: Pass.** The dot layers are hidden from assistive tech.
- **Reduced motion: Pass.** Nothing moves on its own. With reduced motion on, the glow tracks the pointer with no easing.
- **Colour contrast: Not applicable.** Decorative only. Contrast depends on the content you place on top.

## Source

```tsx
"use client";

import type { ReactNode, PointerEvent } from "react";
import { motion, useMotionTemplate, useMotionValue, useReducedMotion, useSpring } from "motion/react";

type DotGlowBackgroundProps = {
  children?: ReactNode;
  /** Distance between dots in pixels. */
  gap?: number;
  /** Radius of the lit area around the pointer. */
  radius?: number;
  className?: string;
};

export function DotGlowBackground({
  children,
  gap = 20,
  radius = 180,
  className = "",
}: DotGlowBackgroundProps) {
  const reduceMotion = useReducedMotion();
  const x = useMotionValue(-1000);
  const y = useMotionValue(-1000);
  // the glow eases after the pointer, unless the user prefers reduced motion
  const smoothX = useSpring(x, { stiffness: 300, damping: 40 });
  const smoothY = useSpring(y, { stiffness: 300, damping: 40 });
  const glowX = reduceMotion ? x : smoothX;
  const glowY = reduceMotion ? y : smoothY;
  const mask = useMotionTemplate`radial-gradient(${radius}px circle at ${glowX}px ${glowY}px, black, transparent)`;
  const dots = (color: string) => ({
    backgroundImage: `radial-gradient(${color} 1px, transparent 1px)`,
    backgroundSize: `${gap}px ${gap}px`,
  });

  function handleMove(event: PointerEvent<HTMLDivElement>) {
    const rect = event.currentTarget.getBoundingClientRect();
    x.set(event.clientX - rect.left);
    y.set(event.clientY - rect.top);
  }

  return (
    <div
      onPointerMove={handleMove}
      onPointerLeave={() => {
        x.set(-1000);
        y.set(-1000);
      }}
      className={`relative isolate overflow-hidden bg-[#0C1010] ${className}`}
    >
      <div aria-hidden className="absolute inset-0 -z-10" style={dots("rgb(255 255 255 / 0.09)")} />
      <motion.div
        aria-hidden
        className="absolute inset-0 -z-10"
        style={{ ...dots("rgb(95 174 180)"), maskImage: mask, WebkitMaskImage: mask }}
      />
      {children}
    </div>
  );
}
```
