Magnet
A wrapper that pulls its child toward the pointer once it comes within a radius of the child's edge, on a loose spring, growing slightly as it is drawn in.
$149 once · every Pro piece
Customize
The inner content trails the frame on a softer spring and sits a little further toward the pointer, so the label lags and catches up. When the pointer leaves, the child snaps back with one overshoot.
Install
npx shadcn@latest add @obsyde/magnetNeeds your licence key · Get Pro
Usage
Import it from where the CLI puts it, or copy the files below by hand.
import { Magnet } from '@/components/obsyde/ember/magnet/Magnet';
export function Example() {
return (
<Magnet />
);
}
Files
What you get with Pro: plain React, TypeScript and CSS, with no dependencies.
ember/magnet/Magnet.tsxcomponentember/magnet/magnet-demo.cssstylesember/magnet/magnet.cssstylesember/magnet/MagnetDemo.tsxdemoember/icon-button/icon-button.csssharedember/icon-button/IconButton.tsxsharedember/shared/ember.csssharedember/actions-kit/kit.tssharedember/shared/accent.tssharedember/shared/spring.tssharedember/button/button.csssharedember/button/Button.tsxsharedember/shared/chart-kit.tssharedember/effects-kit/kit.tsshared
API
| Prop | Type | Default |
|---|---|---|
accentAccent | 'ember' | 'volt' | 'arc' | 'ember' |
strengthStrength | number | 0.3 |
radiusRadius (px) | number | 72 |
parallaxInner lag | number | 0.3 |
scaleScale | number | 1.04 |