# Magnetize — Animated Text Effect for React

> Variable-font text where each glyph swells in weight and gains a faint white glow as the cursor nears, under a steep gaussian falloff. Idles on its own when untouched; static mid-weight under reduced motion.

- Page: https://crucibleui.com/components/text/magnetize
- Category: [text](https://crucibleui.com/components/text)
- Tier: pro (one-time purchase, see https://crucibleui.com/pricing)
- Engine: motion
- npm dependencies: motion

## Install

```bash
npx shadcn@latest add @crucible/magnetize
```

Pro install requires adding the token-bearing `@crucible` registry to components.json (issued at https://crucibleui.com/account after purchase).

Import from `@/components/crucible/magnetize`.

## Props (`MagnetizeProps`)

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `string` | — | The text. Server-renders as plain text; the effect attaches after hydration. |
| `radius?` | `number` | `140` | Proximity radius in px within which glyphs respond to the cursor. |
| `falloff?` | `number` | `2` | Steepness of the gaussian falloff. Higher = tighter, more physical field. |
| `fromFontVariationSettings?` | `string` | `"'wght' 400"` | Resting font-variation-settings, e.g. `"'wght' 400"` or `"'wght' 400, 'wdth' 100"`. The axes named here (unioned with `toFontVariationSettings`) are the axes driven. |
| `toFontVariationSettings?` | `string` | `"'wght' 900"` | Font-variation-settings a glyph reaches at zero cursor distance. |
| `glow?` | `boolean` | `true` | Faint emissive text-shadow on near glyphs as the cursor approaches. |
| `glowColor?` | `string` | `soft white` | Glow color. |
| `idle?` | `boolean` | `true` | Idle autoplay: after 1.5s with no pointer near the text, a ghost point drifts slowly back and forth through the line (at slightly reduced pull) so the letterforms keep swelling; a real pointer takes over instantly. Also animates touch-only devices, which otherwise get the static mid-weight treatment. Never under reduced motion; sleeps offscreen. |

Also accepts: `Omit<React.ComponentPropsWithoutRef<"span">, "children">`.

## Usage example

```tsx
import { Magnetize } from "@/components/crucible/magnetize";

export default function MagnetizeDemo() {
  return (
    <div className="relative isolate flex h-full min-h-[360px] w-full items-center justify-center overflow-hidden rounded-xl bg-neutral-950">
      <div
        aria-hidden
        className="pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_center,rgba(255,255,255,0.035),transparent_70%)]"
      />
      <div className="relative z-10 max-w-2xl px-6 text-center">
        <h2 className="text-5xl tracking-tight text-white">
          <Magnetize>Move your cursor over this</Magnetize>
        </h2>
        <p className="mt-6 text-sm text-neutral-500">
          <Magnetize
            radius={100}
            falloff={2.5}
            fromFontVariationSettings="'wght' 300"
            toFontVariationSettings="'wght' 700"
            glowColor="#93c5fd"
          >
            Bring the pointer close — each letterform swells toward it.
          </Magnetize>
        </p>
        <p className="mt-3 text-[10px] font-medium uppercase tracking-[0.2em] text-neutral-600">
          Custom colors
        </p>
      </div>
    </div>
  );
}
```

## Accessibility & performance

Honors `prefers-reduced-motion` with a designed static frame or fade (never a blank box) and passes `className` through.
