Magnetic Cta

Motion

A magnetic button that drifts toward the cursor on a spring and snaps back on leave. Takes all Button props plus a strength value; static for reduced motion.

src/registry/premium/magnetic-cta.tsx/r/magnetic-cta.json

Hover me

Installation#

bash
npx shadcn@latest add @minidev/magnetic-cta

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/magnetic-cta.json

Usage#

tsx
import { MagneticCta } from "@/components/ui/magnetic-cta"

export function Example() {
  return (
    <MagneticCta size="lg" className="w-full max-w-sm sm:w-auto">Feel the CTA</MagneticCta>
  )
}

API reference#

MagneticCta props
PropTypeDefault
strengthnumber28

Also accepts every prop of Button props, passed through to the root element.

Dependencies#

npm

motion

Built from

Examples#

All button components

Learn more