React + MotionButtons

Light border button

A thin streak of light runs around the edge of the button, slowly and without stopping.

Settings

3s

Code

import { motion } from "framer-motion";

interface RotatingLightBorderProps {
  text?: string;
  color?: string;
  /** Segundos por vuelta del reflejo. */
  speed?: number;
}

export default function RotatingLightBorder({
  text = "Explore",
  color = "#2997ff",
  speed = 3,
}: RotatingLightBorderProps) {
  return (
    <div className="relative overflow-hidden rounded-full p-[1px]">
      <motion.span
        className="absolute inset-[-150%]"
        style={{ background: `conic-gradient(transparent 0 75%, ${color})` }}
        animate={{ rotate: 360 }}
        transition={{ duration: speed, repeat: Infinity, ease: "linear" }}
      />
      <button
        type="button"
        className="relative rounded-full bg-white dark:bg-[#1c1c1e] px-6 py-3 text-sm font-medium text-[#1d1d1f] dark:text-[#f5f5f7]"
      >
        {text}
      </button>
    </div>
  );
}

Prompt for AI

Paste it into ChatGPT, Claude or Cursor and it will adapt the block to your project with these settings, even if you don’t use React.

More in Buttons

Where to use it

This is the understated cousin of the gradient border: one line of light instead of big streaks of color. It suits a premium feel, like the “Explore collection” link of a jeweler or the “Watch the film” button on a studio reel. Next to louder effects, this rotating light border reads as confident rather than flashy.

Around three seconds per lap looks elegant; faster starts to feel like a loading spinner. A bright accent on a dark page works best, since on white backgrounds the thin line can almost vanish.