A lightweight React component for creating draggable, rotatable and scalable elements with connection capabilities.
ES Drager provides a simple yet powerful way to add drag, rotate, scale, and resize functionality to any React component. With built-in support for connections, alignment guides, position constraints, and snapping, it's perfect for building:
import { Drager } from '@es-space/es-drager-react'
function App() {
return (
<Drager
className="w-32 h-32 bg-blue-500"
rotatable
scalable
resizable
connectable
showGuides
limit={{ minX: 0, maxX: 500, minY: 0, maxY: 500 }}
onConnect={({ sourceId, sourceAnchor, targetId, targetAnchor }) => {
console.log('Connected:', { sourceId, sourceAnchor, targetId, targetAnchor })
}}
>
Try me!
</Drager>
)
}