Hero Highlight
- Source
- Aceternity UI ↗
- Author
- Aceternity UI
- Licence
- Aceternity UI licence (free component)
Loading…
A dot grid lights up around the pointer while a highlight sweeps behind the key phrase.
Code
"use client";
import { motion } from "motion/react";
import { HeroHighlight, Highlight } from "@/lab/aceternity/ui/hero-highlight";
export default function HeroHighlightDemo() {
return (
<div className="h-full w-full overflow-hidden [container-type:inline-size]">
<HeroHighlight containerClassName="h-full">
<motion.h1
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: [20, -5, 0] }}
transition={{ duration: 0.5, ease: [0.4, 0.0, 0.2, 1] }}
className="text-[clamp(1rem,4.6cqw,3rem)] px-4 font-bold text-neutral-700 dark:text-white max-w-4xl leading-relaxed lg:leading-snug text-center mx-auto"
>
With insomnia, nothing's real. Everything is far away. Everything is a{" "}
<Highlight className="text-black dark:text-white">copy, of a copy, of a copy.</Highlight>
</motion.h1>
</HeroHighlight>
</div>
);
}
Prompt
Build "Hero Highlight", a text animation. What it does: A dot grid lights up around the pointer while a highlight sweeps behind the key phrase. 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, pointer tracking. It sits on a light 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/hero-highlight (Aceternity UI, Aceternity UI licence (free component)).