Magnetic
Wrapper whose content is gently pulled toward the cursor.
Import
import { Magnetic } from "@cooud-ui/ui";
npx cooud-ui add magnetic
Examples
API Reference
Generated from the component's exported types.
MagneticProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
strength | number | DEFAULT_STRENGTH | How strongly the content is pulled toward the pointer, as a fraction of the pointer's offset from the wrapper's center. `0` is inert, `1` glues the content to the cursor. Values outside `0–1` are clamped. |
radius | number | DEFAULT_RADIUS | Radius of the magnetic field in pixels, measured from the wrapper's center. The pull is strongest near the center and eases back to zero at this distance, so crossing the field's edge never pops. Pad the wrapper (e.g. `className="p-10"`) to give the field room beyond the content's own box — the attraction can only be felt where the wrapper is hovered. |