MenuClose

Magnetic — React Interaction

Give a button, link, or any small piece of content a gentle pull.

View source
PreviewReact
Starting live preview

Usage

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

export function Action() {
  return <Magnetic strength={18}
    {...{
      strength: 18
    }}
  ><a href="/start">Get started</a></Magnetic>;
}
Implementation notes & API

Accepts children, strength, disabled, className and style. Supply your own link or button; its semantics are preserved. Stable outer hit area. Touch and reduced-motion disable movement. No WebGPU dependency.

PropertyTypeNotes / default
childrenReactNodeYour own content; the default is a demonstration
disabledbooleanfalse; motion also respects system preferences
className / stylestring / CSSPropertiesApplied to the outer container
View source on GitHubFree for commercial projects · MIT