A physics-based text animation where each letter reacts to cursor proximity. Letters are pushed away (or attracted) in real-time with spring dynamics, creating an interactive magnetic force-field effect.
pnpm dlx shadcn@latest add @componentry/text-repelDependencies: framer-motion clsx tailwind-merge
| Prop | Type | Default |
|---|---|---|
text | stringThe text content to display. | — |
radius | numberCursor influence radius in pixels — letters within this distance react. | 120 |
strength | numberMaximum displacement in pixels at closest proximity. | 45 |
mode | "repel" | "attract"Whether letters are pushed away from or pulled toward the cursor. | "repel" |
stiffness | numberSpring stiffness — higher values make letters snap back faster. | 180 |
damping | numberSpring damping — lower values produce bouncier motion. | 14 |
mass | numberSpring mass — higher values make letters feel heavier. | 0.4 |
className | stringAdditional CSS classes for the container. | — |
letterClassName | stringCSS classes applied to each individual letter. | — |
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.
import { TextRepel } from "@/components/ui/text-repel"
<TextRepel
text="Move your cursor here"
className="text-4xl font-bold"
/>