Motion Kit

Text

Text Repel

Splits text into words or characters that repel from the pointer. Framework-agnostic Custom Element.

  • lit
  • gsap

Preview

Words or characters repel from the pointer with a distance-based falloff.
Attributes

Installation

pnpm dlx shadcn@latest add https://motion-kit-astro.vercel.app/r/text-repel.json

Usage

---
import "@/components/motion-kit/text-repel-element.ts";
---

<motion-text-repel text="Hover over me" mode="words"></motion-text-repel>

API Reference

Attribute Type Default
text The text content to display and animate. string ""
mode Whether to split by words or characters. "words" | "chars" "words"
strength Maximum distance in pixels to repel text elements. number 18
radius Radius around the cursor where repel effect is active. number 160
falloff-power Power curve for falloff (higher = sharper falloff). number 1.5
duration Animation duration in seconds. number 0.45
ease easing function for the animation. string "power3.out"
hover-target CSS selector for an external hover target. Defaults to this element. string ""