Components
Magnetic Button
A shadcn-compatible button that subtly follows the cursor using spring-based motion.
interactivemotioncursoranimation
Installation
$npx shadcn@latest add /r/magnetic-button.jsonAPI Reference
| Prop | Type | Default | Description |
|---|---|---|---|
movement | number | 6 | How far (in px) the button drifts toward the cursor on hover. |
children | React.ReactNode | - | Button content. |
className | string | - | Classes merged onto the underlying button. |
...props | React.ComponentProps<typeof Button> | - | All native <button> props via the shadcn Button (e.g. variant, size, disabled, onClick), except 'asChild'. |
Customization
- Pass
classNameto restyle the component — classes are merged withcn, so your utilities win. - Styling uses Tailwind utility classes and theme tokens, so it adapts to light/dark mode automatically.
- Tune behavior with the props in the API reference above (e.g.
movement).