ES Drager

Props Reference

Basic Props

PropTypeDefaultDescription
idstring-Unique identifier for the element. Required when connectable is true.
classNamestring-Additional CSS classes.
styleCSSProperties-Inline styles for dimensions (width, height, minWidth, etc.) and appearance.
selectedbooleanfalseWhether the element is selected.
disabledbooleanfalseWhether the element is disabled.
draggablebooleantrueWhether the element can be dragged.

Position Props

PropTypeDefaultDescription
topnumber0Top position of the element.
leftnumber0Left position of the element.

Feature Props

PropTypeDefaultDescription
rotatablebooleanfalseWhether the element can be rotated.
rotationnumber0Initial rotation angle in degrees.
scalablebooleanfalseWhether the element can be scaled.
resizablebooleanfalseWhether the element can be resized.
connectablebooleanfalseWhether the element can be connected to other elements.
showGuidesbooleanfalseWhether to show alignment guides while dragging.
snapToElementsbooleanfalseWhether to snap to other elements while dragging.
snapThresholdnumber5Distance threshold for snapping in pixels.

Constraint Props

PropTypeDefaultDescription
limit{ minX?: number, maxX?: number, minY?: number, maxY?: number }-Movement boundaries for the element.
minScalenumber0.5Minimum scale factor.
maxScalenumber2Maximum scale factor.

Event Props

PropTypeDescription
onBlur() => voidCalled when the element loses focus.
onClick() => voidCalled when the element is clicked.
onDragStart() => voidCalled when dragging starts.
onDrag(position:{ x: number, y: number }) => voidCalled while dragging with current position.
onDragEnd(position:{ x: number, y: number }) => voidCalled when dragging ends with final position.
onRotate(rotation: number) => voidCalled when rotation changes with current angle.
onScale(scale: number) => voidCalled when scale changes with current scale factor.
onResize(size:{ width: number, height: number }) => voidCalled when size changes with new dimensions.
onConnect(connection: Connection) => voidCalled when a connection is established.