Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Magnetic

Pro

Wraps any element and pulls it toward the pointer.

Installation

pnpm dlx shadcn@latest add @viewport/magnetic

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
strengthnumber

How far the element follows the pointer, from 0 to 1.

0.35
rangenumber

Extra pixels around the element where the pull begins.

40
classNamestring—
children*React.ReactNode—

Accessibility

  • The wrapper is not focusable; your element keeps its own semantics.
  • Disabled for touch input and under reduced motion.