Daniel Petho

Variable Font Hover By Letter

Text 67

About

A text component that animates the font variation settings of letters. Works only with variable fonts. This component is designed to work exclusively with variable fonts. Variable fonts are a modern font technology that allows a single font file to contain multiple variations of a typeface — these variations can be adjusted along different axes, such as weight, width, or slant, etc.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Variable Font Hover By Letter to your project and fits it to your theme.

Code

How Variable Font Hover By Letter is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

'use client'

import { VariableFontHoverByLetter } from "@/components/ui/variable-font-hover-by-letter"

function JobListingsExample() {
  return (
    <div className="w-full h-full rounded-lg sm:text-xl xs:text-sm md:text-2xl xl:text-3xl flex flex-col items-center justify-center font-overusedGrotesk">
      <div className="w-full justify-start items-center p-6 sm:p-8 md:p-12 lg:p-16">
        <div className="w-3/4">
          <h2>OPEN ROLES ✽</h2>
          <ul className="flex flex-col space-y-1 mt-6 md:mt-12 h-full cursor-pointer">
            <VariableFontHoverByLetter
              label="DESIGN ENGINEER (US)"
              staggerDuration={0.03}
              fromFontVariationSettings="'wght' 400, 'slnt' 0"
              toFontVariationSettings="'wght' 900, 'slnt' -10"
            />
            <VariableFontHoverByLetter
              label="PRODUCT DESIGNER (US/UK)"
              staggerDuration={0.0}
              transition={{ duration: 1, type: "spring" }}
              fromFontVariationSettings="'wght' 400, 'slnt' -10"
              toFontVariationSettings="'wght' 900, 'slnt' -10"
            />
            <VariableFontHoverByLetter
              label="ENGINEERING MANAGER (US)"
              fromFontVariationSettings="'wght' 400, 'slnt' 0"
              toFontVariationSettings="'wght' 900, 'slnt' -10"
              staggerFrom={"last"}
            />
            <VariableFontHoverByLetter
              label="SALES ENGINEER (US)"
              staggerFrom={"center"}
              fromFontVariationSettings="'wght' 400, 'slnt' 0"
              toFontVariationSettings="'wght' 900, 'slnt' -10"
            />
          </ul>
        </div>
      </div>
    </div>
  )
}

function StaggerDirectionsExample() {
  return (
    <div className="space-y-6 p-8">
      <VariableFontHoverByLetter
        label="FROM FIRST LETTER"
        staggerFrom="first"
        fromFontVariationSettings="'wght' 400"
        toFontVariationSettings="'wght' 900"
      />
      <VariableFontHoverByLetter
        label="FROM LAST LETTER"
        staggerFrom="last"
        fromFontVariationSettings="'wght' 400"
        toFontVariationSettings="'wght' 900"
      />
      <VariableFontHoverByLetter
        label="FROM CENTER"
        staggerFrom="center"
        fromFontVariationSettings="'wght' 400"
        toFontVariationSettings="'wght' 900"
      />
    </div>
  )
}

function TimingExample() {
  return (
    <div className="space-y-6 p-8">
      <VariableFontHoverByLetter
        label="QUICK TRANSITION"
        staggerDuration={0.01}
        transition={{ duration: 0.3, type: "spring" }}
        fromFontVariationSettings="'wght' 400"
        toFontVariationSettings="'wght' 900"
      />
      <VariableFontHoverByLetter
        label="SLOW TRANSITION"
        staggerDuration={0.05}
        transition={{ duration: 1.2, type: "spring" }}
        fromFontVariationSettings="'wght' 400"
        toFontVariationSettings="'wght' 900"
      />
    </div>
  )
}

function StyleVariationsExample() {
  return (
    <div className="space-y-6 p-8">
      <VariableFontHoverByLetter
        label="WEIGHT CHANGE"
        fromFontVariationSettings="'wght' 400"
        toFontVariationSettings="'wght' 900"
      />
      <VariableFontHoverByLetter
        label="WEIGHT AND SLANT"
        fromFontVariationSettings="'wght' 400, 'slnt' 0"
        toFontVariationSettings="'wght' 900, 'slnt' -10"
      />
    </div>
  )
}

export {
  JobListingsExample,
  StaggerDirectionsExample,
  TimingExample,
  StyleVariationsExample
}

Dependencies

More by Daniel Petho

View all
  • Parallax Floating

    Parallax Floating

    2.2K
  • Text Rotate

    Text Rotate

    2.1K
  • Typewriter

    Typewriter

    1.9K
  • Marquee Along SVG Path

    Marquee Along SVG Path

    1.4K
  • Image Trail

    Image Trail

    1.4K
  • Animated Gradient With SVG

    Animated Gradient With SVG

    884
  • Text Cursor Proximity

    Text Cursor Proximity

    781
  • Pixel Trail

    Pixel Trail

    645

More in Text

View all
  • Vertical Cut Reveal Characters

    Vertical Cut Reveal Characters

    103
  • Rainbow Text Effect

    Rainbow Text Effect

    47
  • Motion Blur Text

    Motion Blur Text

    36
  • Text Loop

    Text Loop

    310
  • Text Reveal

    Text Reveal

    27
  • Apple Hello Effect

    Apple Hello Effect

    610
  • Typography

    Typography

    4
  • Animated Text

    Animated Text

    8