motion-magnetic

Pulls the element toward the cursor as it moves across it. Springs back smoothly on leave.

Preview

Import

Usage

Properties

Attribute Property Type Default Description
strength strength number 0.4 Fraction of cursor offset to apply (0 = none, 1 = full)
duration duration number 0.5 Spring duration hint in seconds

Accessibility

Respects prefers-reduced-motion: when enabled, the magnetic pull is disabled and the element stays at its natural position.