# Spotlight card

> A soft circle of light follows your cursor across the card and fades out when you leave.

- Category: [Cards](https://library.aimran.es/components/cards)
- Built with: React + Motion
- Live editor: https://library.aimran.es/blocks/glow-card
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

The spotlight effect is popular on dark landing pages for a reason: it makes a grid of feature cards feel interactive without moving anything. Use it for the features section of a SaaS site, the service list of an agency or a row of plans. It is the glow card hover effect a lot of people go looking for.

It needs a dark or mid-tone background to show; on white the light almost disappears. Match the glow to your accent color and keep the intensity moderate so the text on top stays easy to read.

## Code

### React (Motion)

```tsx
import { useRef, useState } from "react";

interface GlowCardProps {
  intensity?: number;
  glow?: string;
  radius?: number;
}

export default function GlowCard({
  intensity = 1,
  glow = "#6366f1",
  radius = 16,
}: GlowCardProps) {
  const [pos, setPos] = useState({ x: 50, y: 50 });
  const [hover, setHover] = useState(false);
  const ref = useRef<HTMLDivElement>(null);

  return (
    <div
      ref={ref}
      className="relative w-64 overflow-hidden border border-black/10 bg-white p-6 text-[#1d1d1f] dark:border-white/10 dark:bg-[#1c1c1e] dark:text-[#f5f5f7]"
      style={{ borderRadius: radius }}
      onMouseEnter={() => setHover(true)}
      onMouseLeave={() => setHover(false)}
      onMouseMove={(e) => {
        const el = ref.current;
        if (!el) return;
        const r = el.getBoundingClientRect();
        setPos({
          x: ((e.clientX - r.left) / r.width) * 100,
          y: ((e.clientY - r.top) / r.height) * 100,
        });
      }}
    >
      <div
        className="pointer-events-none absolute inset-0 transition-opacity duration-300"
        style={{
          opacity: hover ? Math.min(1, intensity * 0.6) : 0,
          background: `radial-gradient(320px circle at ${pos.x}% ${pos.y}%, ${glow}55, transparent 70%)`,
        }}
      />
      <div className="relative">
        <div className="mb-4 h-10 w-10 rounded-full" style={{ backgroundColor: glow }} />
        <h3 className="text-base font-semibold">Spotlight</h3>
        <p className="mt-1.5 text-sm text-[#86868b]">
          A radial glow follows the cursor across the card.
        </p>
      </div>
    </div>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Spotlight card” block (Cards) from AIMRAN Library to my project.

## What it is
A soft circle of light follows your cursor across the card and fades out when you leave.

## Chosen settings
- Intensity: 1 (from 0.2 to 2)
- Glow color: #6366f1
- Radius: 16px (from 0 to 32px)

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with React + TypeScript, with framer-motion for the animation and lucide-react for the icons. If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
import { useRef, useState } from "react";

interface GlowCardProps {
  intensity?: number;
  glow?: string;
  radius?: number;
}

export default function GlowCard({
  intensity = 1,
  glow = "#6366f1",
  radius = 16,
}: GlowCardProps) {
  const [pos, setPos] = useState({ x: 50, y: 50 });
  const [hover, setHover] = useState(false);
  const ref = useRef<HTMLDivElement>(null);

  return (
    <div
      ref={ref}
      className="relative w-64 overflow-hidden border border-black/10 bg-white p-6 text-[#1d1d1f] dark:border-white/10 dark:bg-[#1c1c1e] dark:text-[#f5f5f7]"
      style={{ borderRadius: radius }}
      onMouseEnter={() => setHover(true)}
      onMouseLeave={() => setHover(false)}
      onMouseMove={(e) => {
        const el = ref.current;
        if (!el) return;
        const r = el.getBoundingClientRect();
        setPos({
          x: ((e.clientX - r.left) / r.width) * 100,
          y: ((e.clientY - r.top) / r.height) * 100,
        });
      }}
    >
      <div
        className="pointer-events-none absolute inset-0 transition-opacity duration-300"
        style={{
          opacity: hover ? Math.min(1, intensity * 0.6) : 0,
          background: `radial-gradient(320px circle at ${pos.x}% ${pos.y}%, ${glow}55, transparent 70%)`,
        }}
      />
      <div className="relative">
        <div className="mb-4 h-10 w-10 rounded-full" style={{ backgroundColor: glow }} />
        <h3 className="text-base font-semibold">Spotlight</h3>
        <p className="mt-1.5 text-sm text-[#86868b]">
          A radial glow follows the cursor across the card.
        </p>
      </div>
    </div>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
