logo
ComponentsDesign
Trailing Cursor
Text LiftWavy WordWavy Line

Made with 💙 by @kaialan

Copyright © 2024 All Rights Reserved.

Explore

GalleryComponentsExamplesDesign System

Lets connect

Contact meTwitterGithub

Text Lift

A Hover Lift effect animates each character of the text, creating a visual where letters lift upward on hover.

Text Lift
Hero Section
Text Effect
Hover Effect
EXTREME

Installation

1

Install dependencies

2

Add util file

Add this code to your util file.

3

Copy the source code

components/ui/text-lift.tsx

On this page

PreviewInstallation
npm i clsx tailwind-merge
import { ClassValue, clsx } from "clsx";
  import { twMerge } from "tailwind-merge";
  
  export function cn(...inputs: ClassValue[]) {
    return twMerge(clsx(inputs));
  }
  
import { cn } from "@/lib/utils";

const TextLift = ({ value, className }: { value: string; className?: string }) => {
  const characters = value.split("");
  return (
    <div className={cn("relative w-full px-2 py-1 flex text-center text-9xl font-semibold cursor-default  overflow-hidden", className)}>
      <span className=" inline-flex overflow-hidden">
        {characters.map((char, index) => {
          return (
            <span
              key={index}
              data-char={char}
              className={`relative transition-transform duration-500 before:content-[attr(data-char)] before:left-0 before:absolute before:-top-full hover:translate-y-full hover:transform-cpu`}
            >
              {char}
            </span>
          );
        })}
      </span>
    </div>
  );
};

export default TextLift;