Magnetic Button

A responsive button with subtle proximity-based physics that pulls towards the cursor on hover and snaps back on departure.

Hover cursor around button to test magnetic pull

Installation

Add the component directly to your repository using shadcn CLI:

npx shadcn@latest add Surajmaurya1/easyui/magnetic-button

API Reference

PropTypeDefaultDescription
strengthnumber0.35Cursor pull distance multiplier
variant'primary' | 'secondary' | 'outline' | 'ghost''primary'Visual surface presentation
size'sm' | 'md' | 'lg''md'Button dimensions and typography
glowbooleantrueEnable subtle background glow on hover