Phuc Bui

Magnetic

Buttons

About

Add smooth magnetic attraction effects for any HTML elements.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Magnetic to your project and fits it to your theme.

Code

How Magnetic is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { Magnetic } from "@/components/ui/magnetic";

export default function DemoOne() {
  return (
        <div className="h-screen w-full flex items-center justify-center bg-slate-50">
            <Magnetic distance={50} attraction={0.5}>
                <button
                    className="relative inline-flex items-center justify-center px-8 py-4 rounded-2xl bg-blue-600 hover:bg-blue-700 text-white font-bold shadow-lg shadow-blue-500/50 transition-colors duration-200"
                >
                    HOVER ON ME
                </button>
            </Magnetic>
        </div>
    );
}

Dependencies

More by Phuc Bui

View all
  • Moving Border

    Moving Border

    449
  • Draw SVG

    Draw SVG

    1
  • Infinite Image Carousel

    Infinite Image Carousel

    1
  • Shimmer Layer

    Shimmer Layer

  • Text Ripple

    Text Ripple

More in Buttons

View all
  • Button Save

    Button Save

    46
  • Button

    Button

    20
  • Eclipse Button

    Eclipse Button

    5
  • Button

    Button

    6
  • Button

    Button

    14
  • Button Group

    Button Group

    37
  • Button

    Button

    32
  • Split Button

    Split Button

    32