Magnetic Element
Motion
Playful Tailwind magnetic element and Tailwind CSS interactive button components featuring cursor-attracting spring physics.
Add a delightful layer of interactivity to your interface with a Tailwind magnetic element. Perfect for primary calls to action, these Tailwind CSS interactive button wrappers use advanced spring physics to pull elements gently toward the user's cursor as they hover near, creating a tangible sense of mass and magnetism.
Magnetic elements work wonderfully when wrapping a standard Button or combined with a Social Share icon group for added flair.
Implementation
Usage
Magnetic Buttons
Strong Pull
Strong pull →
Higher strength value
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Content to make magnetic |
className | string | "" | Additional CSS classes |
strength | number | 0.3 | Attraction intensity (0–1) |