UIPin
ComponentsIconsIllustrationsMotionTemplatesApps
Boards
UIPin

Free, open-source UI components, icons, illustrations, motion, templates and apps, in one search. Every item links to its source and licence.

UIPin is free. If it saved you time, you can keep it running:

Buy me a coffee
ComponentsIconsIllustrationsMotionTemplatesAppsLibrariesCompareNew this weekMCP for agentsBoardsPrivacy

Components, icons and artwork belong to their authors and are shown under their open-source licences.

Eldora UI/Scale Letter Text

Text effects
1 of 2
Compiling

Theme it

Every preview, live

Brand colour

Corner radius

Font

Recolours shadcn’s tokens, Tailwind’s accent colours and colours set in the code. Red, amber and green classes stay, since they usually mean error, warning or success.

2 versions·1 libraryCompare all text animations →

  • Scale Letter Text
  • Letter Pull Up Text

Scale Letter Text

A scale letter text component.

npx shadcn@latest add https://eldoraui.site/r/scale-letter-text.json
Open in v0 Docs Repo
Library
Eldora UI
License
MIT
Stack
React · Tailwind CSS
Size
81 lines
Demo
From Eldora UI

Code

registry/eldoraui/scale-letter-text.tsx

"use client"

import React, { useState } from "react"

interface ScaleLetterTextProps {
  text: string
  className?: string
}

export default function ScaleLetterText({
  text,
  className = "",
}: ScaleLetterTextProps) {
  const [hoveredIndex, setHoveredIndex] = useState<number>(-1)

  const getLetterStyle = (index: number) => {
    const isHovered = hoveredIndex === index
    const distance = hoveredIndex >= 0 ? Math.abs(index - hoveredIndex) : 0

    let scale = 1
    let translateY = 0
    let rotateX = 0
    let brightness = 1

    if (hoveredIndex >= 0) {
      if (isHovered) {
        scale = 1.4
        translateY = -20
        rotateX = -15
        brightness = 1.3
      } else if (distance === 1) {
        scale = 1.2
        translateY = -10
        rotateX = -8
        brightness = 1.15
      } else if (distance === 2) {
        scale = 1.1
        translateY = -5
        rotateX = -4
        brightness = 1.08
      }
    }

    return {
      transform: `
                perspective(1000px) 
                translateY(${translateY}px) 
                rotateX(${rotateX}deg) 
                scale(${scale})
                translateZ(${isHovered ? 30 : distance <= 2 ? 15 : 0}px)
            `,
      filter: `brightness(${brightness})`,
      textShadow:
        distance <= 2
          ? "0 2px 6px rgba(0,0,0,0.15)"
          : "0 1px 2px rgba(0,0,0,0.08)",
      transition: "all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275)",
      zIndex: isHovered ? 10 : distance <= 2 ? 5 : 1,
      marginRight: "0.1em",
    }
  }

  return (
    <div className={className}>
      {text.split("").map((letter, index) => (
        <span
          key={index}
          className="relative inline-block cursor-pointer"
          style={getLetterStyle(index)}
          onMouseEnter={() => setHoveredIndex(index)}
          onMouseLeave={() => setHoveredIndex(-1)}
        >
          <span className="font-bold">
            {letter === " " ? "\u00A0" : letter}
          </span>
        </span>
      ))}
    </div>
  )
}

More like this

Tooltip

shadcn/ui·Overlays

Hyper Text

Magic UI·Text effects

Interactive Hover Button

Magic UI·Buttons

8-bit Tooltip

8bitcn·Overlays

Target Cursor

React Bits·Cursor & effectsMIT+

Drape Background

Kokonut UI·Backgrounds

Stroke Text

React Bits·Text effectsMIT+

Fuzzy Text

React Bits·Text effectsMIT+

Scroll Index

Kokonut UI·Text effects

Card Nav

React Bits·NavigationMIT+

8-bit Health Bar

8bitcn·Feedback & loaders

8-bit Mana Bar

8bitcn·Feedback & loaders

8-bit Progress

8bitcn·Feedback & loaders

Glyph Background

Animate UI·BackgroundsMIT+

8-bit Slider

8bitcn·Inputs & forms