Glowing Effect
- Source
- Aceternity UI ↗
- Author
- Aceternity UI
- Licence
- Aceternity UI licence (free component)
Loading…
Card borders light up with a conic gradient that tracks the nearby pointer.
Code
"use client";
import { Box, Lock, Search, Settings, Sparkles } from "lucide-react";
import { Fit } from "./_fit";
import { GlowingEffect } from "@/lab/aceternity/ui/glowing-effect";
export default function GlowingEffectDemo() {
return (
<Fit width={1100} height={600}>
<div className="flex h-full w-full items-center p-4">
<ul className="grid w-full grid-cols-12 grid-rows-2 gap-4 max-h-[34rem]">
<GridItem
area="[grid-area:1/1/2/5]"
icon={<Box className="h-4 w-4 text-black dark:text-neutral-400" />}
title="Do things the right way"
description="Running out of copy so I'll write anything."
/>
<GridItem
area="[grid-area:2/1/3/5]"
icon={<Settings className="h-4 w-4 text-black dark:text-neutral-400" />}
title="The best AI code editor ever."
description="Yes, it's true. I'm not even kidding. Ask my mom if you don't believe me."
/>
<GridItem
area="[grid-area:1/5/3/8]"
icon={<Lock className="h-4 w-4 text-black dark:text-neutral-400" />}
title="You should buy Aceternity UI Pro"
description="It's the best money you'll ever spend"
/>
<GridItem
area="[grid-area:1/8/2/13]"
icon={<Sparkles className="h-4 w-4 text-black dark:text-neutral-400" />}
title="This card is also built by Cursor"
description="I'm not even kidding. Ask my mom if you don't believe me."
/>
<GridItem
area="[grid-area:2/8/3/13]"
icon={<Search className="h-4 w-4 text-black dark:text-neutral-400" />}
title="Coming soon on Aceternity UI"
description="I'm writing the code as I record this."
/>
</ul>
</div>
</Fit>
);
}
interface GridItemProps {
area: string;
icon: React.ReactNode;
title: string;
description: React.ReactNode;
}
const GridItem = ({ area, icon, title, description }: GridItemProps) => {
return (
<li className={`min-h-[14rem] list-none ${area}`}>
<div className="relative h-full rounded-3xl border p-3">
<GlowingEffect
spread={40}
glow={true}
disabled={false}
proximity={64}
inactiveZone={0.01}
/>
<div className="border-0.75 relative flex h-full flex-col justify-between gap-6 overflow-hidden rounded-xl p-6 md:p-6 dark:shadow-[0px_0px_27px_0px_#2D2D2D]">
<div className="relative flex flex-1 flex-col justify-between gap-3">
<div className="w-fit rounded-lg border border-gray-600 p-2">
{icon}
</div>
<div className="space-y-3">
<h3 className="-tracking-4 pt-0.5 font-sans text-2xl/[1.875rem] font-semibold text-balance text-black dark:text-white">
{title}
</h3>
<h2 className="font-sans text-base/[1.375rem] text-black dark:text-neutral-400 [&_b]:md:font-semibold [&_strong]:md:font-semibold">
{description}
</h2>
</div>
</div>
</div>
</div>
</li>
);
};
Prompt
Build "Glowing Effect", a card animation. What it does: Card borders light up with a conic gradient that tracks the nearby pointer. Write it as a single self-contained React component in TypeScript that fills its parent (w-full h-full), styled with Tailwind CSS, using lucide-react, motion. Technique: a requestAnimationFrame loop, the Motion library, pointer tracking. It sits on a dark background, in a 16:10 frame. Respect prefers-reduced-motion with a still state, pause work when the element is off screen, and keep it accessible. Original: https://ui.aceternity.com/components/glowing-effect (Aceternity UI, Aceternity UI licence (free component)).