Glowing Stars
- Source
- Aceternity UI ↗
- Author
- Aceternity UI
- Licence
- Aceternity UI licence (free component)
Loading…
A grid of tiny stars glows at random, and all of them light up on hover.
Code
"use client";
import React from "react";
import {
GlowingStarsBackgroundCard,
GlowingStarsDescription,
GlowingStarsTitle,
} from "@/lab/aceternity/ui/glowing-stars";
import { Fit } from "./_fit";
export default function GlowingStarsBackgroundCardPreview() {
return (
<Fit width={420} height={360} max={1.5}>
<div className="flex h-full items-center justify-center antialiased">
<GlowingStarsBackgroundCard>
<GlowingStarsTitle>Next.js 14</GlowingStarsTitle>
<div className="flex items-end justify-between">
<GlowingStarsDescription>
The power of full-stack to the frontend. Read the release notes.
</GlowingStarsDescription>
<div className="flex h-8 w-8 items-center justify-center rounded-full bg-[hsla(0,0%,100%,.1)]">
<Icon />
</div>
</div>
</GlowingStarsBackgroundCard>
</div>
</Fit>
);
}
const Icon = () => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
strokeWidth="1.5"
stroke="currentColor"
className="h-4 w-4 stroke-2 text-white"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M17.25 8.25L21 12m0 0l-3.75 3.75M21 12H3"
/>
</svg>
);
};
Prompt
Build "Glowing Stars", a card animation. What it does: A grid of tiny stars glows at random, and all of them light up on hover. Write it as a single self-contained React component in TypeScript that fills its parent (w-full h-full), styled with Tailwind CSS, using motion. Technique: the Motion library, inline SVG. It sits on a light background, in a square 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-stars-effect (Aceternity UI, Aceternity UI licence (free component)).