Each letter lifts and tints as the cursor passes over it.
npx @agents-npm-packages/vibeui add letter-hover --dir ./src/components/uiImport
import { LetterHover } from "@/components/ui/letter-hover"Generated from the component's TypeScript types, so it always matches the source. * marks a required prop.
| Prop | Type | Default | Description |
|---|---|---|---|
| text* | string | — | The text to render. |
| className | string | — | Extra classes, merged with the component's own. |
import { cn } from "@/lib/utils";
/** Each letter lifts and tints as the cursor passes over it. */
export function LetterHover({
text,
className,
}: {
text: string;
className?: string;
}) {
return (
<span
className={cn("inline-flex font-medium tracking-[-0.02em] text-ink", className)}
aria-label={text}
>
{text.split("").map((char, i) => (
<span
key={i}
aria-hidden
className="inline-block transition-[transform,color] duration-300 ease-spring hover:-translate-y-1.5 hover:text-accent"
>
{char === " " ? " " : char}
</span>
))}
</span>
);
}
Exports LetterHover. Peer dependencies: clsx, tailwind-merge.