Spring
A flexible, animated spring component that attaches a draggable element to its origin with a spring line.
Made by arhamkhnzInstallation
Usage
Note: Add draggable={false}
to your element (avatar, image, etc.) when
passing it as children. This prevents the browser's native drag image from
interfering with the spring drag animation.
API Reference
SpringProvider
Prop | Type | Default |
---|---|---|
children | React.ReactNode | - |
dragElastic? | number | 0.2 |
transition? | SpringOptions | { type: "spring", stiffness: 200, damping: 16 } |
pathConfig? | SpringPathConfig | {} |
Spring
Prop | Type | Default |
---|---|---|
...props? | React.SVGProps<SVGSVGElement> | - |
SpringElement
Prop | Type | Default |
---|---|---|
children | React.ReactElement | - |
...props? | HTMLMotionProps<"div"> | - |
Credits
- Updated by imskyleen
- Credits to Anh for this X post as inspiration