# Spotlight Card

> A card with a soft glow that tracks the pointer across its surface.

Category: Cards · Free · Updated 2026-10-20 · Live demo: https://www.motionkitui.com/components/spotlight-card

## When to use it

Feature grids, pricing tiers and dashboards on dark pages, where a quiet response to the pointer makes static cards feel alive.

## How it works

The card tracks the pointer's position inside itself in two Motion values. A template string turns them into a radial gradient centred on the cursor, painted on a layer behind the content. Because the values feed the style directly, moving the pointer never re-renders React.

## Installation

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

Or copy `components/motionkit/spotlight-card.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 |
| --- | --- | --- | --- |
| `color` | `string` | `rgb(14 124 134 / 0.32)` | Any CSS color for the glow. |
| `radius` | `number` | `260` | Glow radius in pixels. |

## Accessibility

- **Keyboard: Not applicable.** A static container with nothing to focus. Interactive content you put inside keeps its own behaviour.
- **Screen readers: Pass.** The glow layer is hidden from assistive tech; only your content is read.
- **Reduced motion: Pass.** Nothing animates on its own. The glow tracks the pointer directly with no easing.
- **Colour contrast: Pass.** Default body text measures 7.7:1. Check any colours you add.

## Source

```tsx
"use client";

import type { ComponentProps, PointerEvent } from "react";
import { motion, useMotionTemplate, useMotionValue } from "motion/react";

type SpotlightCardProps = ComponentProps<"div"> & {
  /** Any CSS color for the glow. */
  color?: string;
  /** Glow radius in pixels. */
  radius?: number;
};

export function SpotlightCard({
  color = "rgb(14 124 134 / 0.32)",
  radius = 260,
  className = "",
  children,
  onPointerMove,
  ...props
}: SpotlightCardProps) {
  const mouseX = useMotionValue(-radius);
  const mouseY = useMotionValue(-radius);
  const background = useMotionTemplate`radial-gradient(${radius}px circle at ${mouseX}px ${mouseY}px, ${color}, transparent 80%)`;

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

  return (
    <div
      onPointerMove={handleMove}
      className={`group relative overflow-hidden rounded-2xl border border-white/10 bg-[#0C1010] p-6 ${className}`}
      {...props}
    >
      <motion.div
        aria-hidden
        style={{ background }}
        className="pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-100"
      />
      <div className="relative">{children}</div>
    </div>
  );
}
```
