Word Magnet

A text component where words are repelled by the cursor and snap back with physics-based animations.

Installation

pnpm dlx rareui add WordMagnet

Usage

1

Import the component

import WordMagnet from "@/components/rareui/Text Animation/WordMagnet";
2

Use in your application

export default function MyComponent() { return ( <WordMagnet text="Hover over these words and watch them dance across the screen with physics-based interaction" /> ); }

Features

Words are pushed away by the mouse cursor using spring physics.

Props

PropTypeDefaultDescription
textstring"Hover over..."The text content to display
radiusnumber130Interaction radius in pixels
forcenumber0.45Repulsion force (0.1 to 1.0)
dampingnumber28Spring damping (5 to 50)
returnDelaynumber400Delay before returning to original position in ms
textColorstring"#000000"Text color
fontobject{ fontSize: '32px', ... }Font styling object
disableOnMobilebooleanfalseDisable interaction on mobile devices
overflowstring"visible"CSS overflow property
classNamestring-Additional class names
styleobject-Inline styles