Hover Me

How to use

01Import the component
import { MagneticScatterText } from "@/components/shitui/MagneticScatterText";
02Use in your application
export default function MyComponent() {
return (
  <MagneticScatterText text="Your Text" className="text-6xl" />
);
}

Examples

01Controlled Animation
"use client";
import { useState } from 'react';
import { MagneticScatterText } from "@/components/shitui/MagneticScatterText";

export default function ControlledAnimation() {
const [show, setShow] = useState(false);

return (

<div className="flex flex-col items-center gap-4">
<button
onClick={() => setShow(!show)}
className="px-4 py-2 bg-primary text-primary-foreground rounded-md text-sm font-medium" >
Toggle Animation
</button>

    <MagneticScatterText
      text="Click button"
      trigger={show}
      className="text-4xl text-foreground"
    />
  </div>

);
}
02Custom Styling
<MagneticScatterText 
text="Magnetic" 
className="text-8xl font-black text-blue-500 tracking-tighter"
/>

Features

Text scatters in random directions on hover with physics-based movement.

Props

PropTypeDefaultDescription
textstring-The text content to animate.
triggerbooleantrueControls animation state (true = visible, false = hidden).
classNamestring-Additional styles for the container.
Component Info