ProximityText

Letters swell and lift as the cursor nears them, strongest under the pointer, and settle on springs. Text.

Open playground

About

ProximityText is a React component in the Text category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { ProximityText } from "@ashutoshswamy/smoui" and set text, radius, scale.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { ProximityText } from "@ashutoshswamy/smoui";

<ProximityText text="Come a little closer" className="text-3xl font-semibold" />

Props 3

text

Text to animate.

string
radius

Distance in px at which letters react.

numberdefault 90
scale

Largest vertical scale a letter reaches.

numberdefault 1.35