Original Blocks/Text
Animated Underline
A component that adds an animated underline effect to text.
Hover me
<AnimatedUnderline text="Hover me" />
Installation
Copy and paste the following code into your project.
"use client";
export function AnimatedUnderline({ text = "Hover me" }: { text: string }) {
return (
<div className="relative after:absolute after:bg-[hsl(var(--hu-foreground))] after:bottom-0 after:left-0 after:h-px after:w-full after:origin-bottom-right after:scale-x-0 hover:after:origin-bottom-left hover:after:scale-x-100 after:transition-transform after:ease-in-out after:duration-300">
<span className="text-[hsl(var(--hu-foreground))]">{text}</span>
</div>
);
}
npx shadcn@latest add "https://21st.dev/r/hextaui/animated-underline"
pnpm dlx shadcn@latest add "https://21st.dev/r/hextaui/animated-underline"
yarn dlx shadcn@latest add "https://21st.dev/r/hextaui/animated-underline"
bun x shadcn@latest add "https://21st.dev/r/hextaui/animated-underline"
Usage
import { AnimatedUnderline } from "@/components/ui/AnimatedUnderline";
<AnimatedUnderline text="Hover me" />
Props
Prop | Type | Default |
---|---|---|
text? | string | Hover me |
Edit on GitHub
Last updated on