A ui component.
Install
Add it to your project
Run this in a project set up for shadcn/ui. It writes the files and installs the npm packages.
First time: connect the Infinity UI registry
- Create a personal token on your Tokens page.
- Put it in
.env.localasINFINITYUI_TOKEN. - Add the registry to
components.json:
{
"registries": {
"@infinityui": {
"url": "https://infinityui.io/r/{name}.json",
"headers": {
"Authorization": "Bearer ${INFINITYUI_TOKEN}"
}
}
}
}Using Claude Code, Codex, Cursor, Lovable or v0? See CLI & MCP for a setup prompt.
npm packages it adds
- motion
Code
"use client"
import { motion } from "motion/react"
import UnderlineToBackground from "@/components/fancy/text/underline-to-background"
export default function UnderlineToBackgroundDemo() {
const fadeInVariants = {
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: { duration: 0.5, staggerChildren: 0.1 },
},
}
const wordVariants = {
hidden: { opacity: 0 },
visible: { opacity: 1 },
}
const words = "Weekly goodies delivered straight to your inbox —".split(" ")
return (
<div className="w-dvw h-dvh flex flex-col items-center justify-center bg-[#f5f5f5]">
<motion.h2
className="text-[#0015ff] text-xl p-12 md:p-24"
initial="hidden"
animate="visible"
variants={fadeInVariants}
>
{words.map((word, index) => (
<motion.span
key={index}
variants={wordVariants}
className="inline-block mr-1"
>
{word}
</motion.span>
))}
<motion.span variants={wordVariants} className="inline-block">
<UnderlineToBackground
targetTextColor="#f0f0f0"
className="cursor-pointer"
>
subscribe
</UnderlineToBackground>
</motion.span>
</motion.h2>
</div>
)
}




























