OptionalablesOptionalboundsYou can set up boundaries.
OptionalcheckChecks whether this is an element to input text or contentEditable, and prevents dragging.
OptionalcheckWhether to recalculate when the size to be calculated is different from the actual size
OptionalclassYou can specify the className of the moveable controlbox.
OptionalclickableWhether to trigger the moveable's click event.
OptionalclipYou can drag the clip by setting clipArea.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
clippable: true,
defaultClipPath: "inset",
customClipPath: "",
clipRelative: false,
clipArea: false,
dragWithClip: true,
});
moveable.on("clipStart", e => {
console.log(e);
}).on("clip", e => {
if (e.clipType === "rect") {
e.target.style.clip = e.clipStyle;
} else {
e.target.style.clipPath = e.clipStyle;
}
}).on("clipEnd", e => {
console.log(e);
});
OptionalclipAdd clip guidelines in the horizontal direction.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
clippable: true,
defaultClipPath: "inset",
customClipPath: "",
clipRelative: false,
clipArea: false,
dragWithClip: true,
clipVerticalGuidelines: [0, 100, 200],
clipHorizontalGuidelines: [0, 100, 200],
clipSnapThreshold: 5,
});
OptionalclippableWhether to clip the target.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
clippable: true,
defaultClipPath: "inset",
customClipPath: "",
clipRelative: false,
clipArea: false,
dragWithClip: true,
});
moveable.on("clipStart", e => {
console.log(e);
}).on("clip", e => {
if (e.clipType === "rect") {
e.target.style.clip = e.clipStyle;
} else {
e.target.style.clipPath = e.clipStyle;
}
}).on("clipEnd", e => {
console.log(e);
});
Optionalclip% Can be used instead of the absolute px (rect not possible)
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
clippable: true,
defaultClipPath: "inset",
customClipPath: "",
clipRelative: false,
clipArea: false,
dragWithClip: true,
});
moveable.on("clipStart", e => {
console.log(e);
}).on("clip", e => {
if (e.clipType === "rect") {
e.target.style.clip = e.clipStyle;
} else {
e.target.style.clipPath = e.clipStyle;
}
}).on("clipEnd", e => {
console.log(e);
});
OptionalclipDistance value that can snap to clip guidelines.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
clippable: true,
defaultClipPath: "inset",
customClipPath: "",
clipRelative: false,
clipArea: false,
dragWithClip: true,
clipVerticalGuidelines: [0, 100, 200],
clipHorizontalGuidelines: [0, 100, 200],
clipSnapThreshold: 5,
});
OptionalclipWhether the clip is bound to the target.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
clippable: true,
defaultClipPath: "inset",
customClipPath: "",
clipRelative: false,
clipArea: false,
dragWithClip: true,
clipTargetBounds: true,
});
moveable.on("clipStart", e => {
console.log(e);
}).on("clip", e => {
if (e.clipType === "rect") {
e.target.style.clip = e.clipStyle;
} else {
e.target.style.clipPath = e.clipStyle;
}
}).on("clipEnd", e => {
console.log(e);
});
OptionalclipAdd clip guidelines in the vertical direction.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
clippable: true,
defaultClipPath: "inset",
customClipPath: "",
clipRelative: false,
clipArea: false,
dragWithClip: true,
clipVerticalGuidelines: [0, 100, 200],
clipHorizontalGuidelines: [0, 100, 200],
clipSnapThreshold: 5,
});
OptionalcontainerA container into which Moveables are inserted. Set it only when used within the slot of Web Components or when the container is different.
OptionalcontrolBy adding padding to the control, you can increase the area of the control that can be clicked and dragged.
Either rotateAroundControls or displayAroundControls can be used.
Optionalcspadd nonce property to style for CSP.
OptionalcustomYou can force the custom clipPath. (defaultClipPath < style < customClipPath < dragging clipPath)
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
clippable: true,
defaultClipPath: "inset",
customClipPath: "",
clipRelative: false,
clipArea: false,
dragWithClip: true,
});
moveable.on("clipStart", e => {
console.log(e);
}).on("clip", e => {
if (e.clipType === "rect") {
e.target.style.clip = e.clipStyle;
} else {
e.target.style.clipPath = e.clipStyle;
}
}).on("clipEnd", e => {
console.log(e);
});
OptionaldefaultIf clippath is not set, the default value can be set. (defaultClipPath < style < customClipPath < dragging clipPath)
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
clippable: true,
defaultClipPath: "inset",
customClipPath: "",
clipRelative: false,
clipArea: false,
dragWithClip: true,
});
moveable.on("clipStart", e => {
console.log(e);
}).on("clip", e => {
if (e.clipType === "rect") {
e.target.style.clip = e.clipStyle;
} else {
e.target.style.clipPath = e.clipStyle;
}
}).on("clipEnd", e => {
console.log(e);
});
OptionaldefaultSets the initial transform origin of the group.
OptionaldefaultSets the initial rotation of the group.
OptionaldisplayYou can expand the area around the control.
Either rotateAroundControls or displayAroundControls can be used.
You can set the area through the controlPadding value.
OptionaldragInstead of firing an event on the target, we add it to the moveable control element. You can use click and clickGroup events. Add an event to the moveable area instead of the target for stopPropagation.
OptionaldragContainer area where drag works
OptionaldragWhether to drag the focused input
If checkInput is true, this option is not applied.
OptionaldraggableWhether or not target can be dragged.
OptionaldragThe external target(s) to drag Moveable target(s)
OptionaldragIf dragTarget is set directly, taget itself cannot be dragged. Whether to drag the target as well.
OptionaldragWhen dragging the target, the clip also moves.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
clippable: true,
defaultClipPath: "inset",
customClipPath: "",
clipRelative: false,
clipArea: false,
dragWithClip: true,
});
moveable.on("clipStart", e => {
console.log(e);
}).on("clip", e => {
if (e.clipType === "rect") {
e.target.style.clip = e.clipStyle;
} else {
e.target.style.clipPath = e.clipStyle;
}
}).on("clipEnd", e => {
console.log(e);
});
OptionaledgeWhether to scale and resize through edge lines. You can use "n", "w", "s", "e" in LineDirection array.
OptionaledgeWhether to move by dragging the edge line
OptionalelementAdd guidelines for the element.
OptionalelementYou can specify the snap directions of elements.
OptionalflushIf you are using React 18's concurrent mode, use flushSync for UI sync.
OptionalgetSets a function to get the scroll position.
OptionalgroupableProps that work when group
OptionalhideWhether to hide the line in child moveable for group corresponding to the rect of the target.
OptionalhideWhether to hide the line corresponding to the rect of the target.
OptionalhideHides the guidelines that appear when using the throttleDragRotate prop.
OptionalhorizontalAdd guidelines in the horizontal direction.
OptionalindividualCreate targets individually, not as a group.
OptionalindividualWhen using individualGroupable you can pass props to child moveable.
OptionalinnerYou can set up inner boundaries.
OptionalisWhether to show guideline of snap by grid
OptionalisWhether to show element inner snap distance
OptionalisWhether to show a round control that does not actually exist as a shadow
OptionalisWhether to show snap distance.
OptionalkeepWhen resize or scale, keeps a ratio of the width, height.
OptionalkeepThe size can be changed by format and throttle, but the ratio is maintained at the end. Forced true when using groups.
OptionallineBy adding padding to the line, you can increase the area of the line that can be clicked and dragged.
OptionalmaxMaximum number of round controls. It moves in proportion by control. [horizontal, vertical]
OptionalmaxMaximum distance to which element gap guidelines can be snapped.
OptionalmaxMaximum distance to which element guidelines can be snapped.
OptionalminMinimum number of round controls. It moves in proportion by control. [horizontal, vertical]
OptionaloriginWhether or not the origin control box will be visible or not.
OptionaloriginWhether to drag origin.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
originDraggable: true,
});
let translate = [0, 0];
moveable.on("dragOriginStart", e => {
e.dragStart && e.dragStart.set(translate);
}).on("dragOrigin", e => {
translate = e.drag.beforeTranslate;
e.target.style.cssText
= `transform-origin: ${e.transformOrigin};`
+ `transform: translate(${translate[0]}px, ${translate[1]}px)`;
}).on("dragOriginEnd", e => {
console.log(e);
});
Optionalorigin% Can be used instead of the absolute px.
OptionalpaddingAdd padding around the target to increase the drag area.
OptionalpassSet pointerEvents: none; css to pass events in dragArea.
OptionalpersistData for first render
OptionalpinchableWhether or not target can be pinched with draggable, resizable, scalable, rotatable.
OptionalpinchWhether the container containing the target becomes a pinch.
OptionalpinchMinimum distance to pinch.
OptionalpreventPrevent click event on dragStart. (mousedown, touchstart)
OptionalpreventPrevent click event on drag. (mousemove, touchmove)
OptionalpreventWhether to call preventDefault on touchstart or mousedown
OptionalpreventWhether to prevent dragging using the right mouse button
OptionalpreventWhether to prevent dragging using the wheel (middle) mouse button
OptionalpropsYou can use props in object format or custom props.
OptionalrenderSet directions to show the control box.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
warpable: true,
renderDirections: ["n", "nw", "ne", "s", "se", "sw", "e", "w"],
});
moveable.renderDirections = ["nw", "ne", "sw", "se"];
OptionalresizableWhether or not target can be resized.
OptionalresizeFunction to convert size for resize.
OptionalresolveSets the control that will cause resize along with rotate. (Only Single Target, Only resizable, Beta)
OptionalrootMoveable Root Container (No Transformed Container)
OptionalrotatableWhether or not target can be rotated.
OptionalrotateYou can rotate around direction controls.
Either rotateAroundControls or displayAroundControls can be used.
OptionalrotationYou can specify the position of the rotation.
OptionalrotationSet additional rotationTargets.
OptionalroundableWhether to show and drag or double click border-radius.
OptionalroundWhether you can add/delete round controls by double-clicking a line or control.
OptionalroundThe padding value of the position of the round control
Optionalround% Can be used instead of the absolute px
OptionalscalableWhether or not target can be scaled.
OptionalscrollableWhether or not target can be scrolled to the scroll container
OptionalscrollThe container to which scroll is applied
OptionalscrollOption to scroll with dragging
OptionalscrollExpand the range of the scroll check area.
OptionalscrollTime interval that occurs when scrolling occurs when dragging is maintained If set to 0, it does not occur.
OptionalsnapA snap container that is the basis for snap, bounds, and innerBounds.
Optionalsnapsnap distance digits.
OptionalsnapYou can specify the directions to snap to the target.
OptionalsnapYou can set the text format of the distance shown in the guidelines.
OptionalsnapWhen you drag, make the gap snap in the element guidelines.
OptionalsnapIn the case of a group, if snapGridWidth and snapGridHeight are used, all children can be snapped.
Custom fixed directions are not yet allowed. Also, it cannot be applied if rotated.
OptionalsnapIf height size is greater than 0, you can horizontal snap to the grid.
OptionalsnapIf width size is greater than 0, you can vertical snap to the grid.
OptionalsnapDistance horizontal between horizontal value that can snap to guidelines.
OptionalsnappableWhether or not target can be snapped to the guideline.
OptionalsnapDistance value that render snapped guidelines.
Optionalsnapdegree angles to snap to rotation
OptionalsnapSnap works if abs(current rotation - snapRotationDegrees) < snapRotationThreshold.
Optionalsnap/**
snapHorizontalThreshold and snapVerticalThresholdOptionalsnapDistance Horizontal value that can snap to guidelines.
Optionalstartstart angle(degree) of x,y for throttleDragRotate when drag.
OptionalstopWhether to prevent bubbling of events like mousedown, touchstart, etc.
OptionalsvgSets the transform origin based on the svg target. If not set, it is set as the transform origin based on the owner of svg.
OptionaltargetThe target to indicate Moveable Control Box.
OptionaltargetThe nested groups of the targets, made from the nested arrays in target.
Moveable sets it itself when it renders a group.
Optionalthrottlethrottle of x, y when drag.
Optionalthrottlethrottle of angle(degree) of x,y when drag.
Optionalthrottlethrottle of width, height when resize. If throttleResize is set to less than 1, the target may shake.
Optionalthrottlethrottle of angle(degree) when rotate.
Optionalthrottlethrottle of scaleX, scaleY when scale.
OptionaltransformThe default transformOrigin of the target can be set in advance.
OptionaltranslateYou can set the translateZ value of moveable.
OptionaltriggerLets generate events of ables at the same time. (like Resizable, Scalable)
OptionaluseWhether to accurately show the position of a movable control box Because getBoundingClientRect is used, css zoom, transform: rotate between container and rootContainer cannot be used. group is not supported.
OptionaluseUse the defaultGroupRotate even if the children's rotations match.
OptionaluseWhether the target size, pos in inline style is detected and updated whenever it changes.
It is more effective when used together with useResizeObserver.
OptionaluseWhether the target size is detected and updated whenever it changes.
It is more effective when used together with useMutationObserver.
OptionalverticalAdd guidelines in the vertical direction.
OptionalviewIf you want to set the dragging information to the viewer, refer to the following.
OptionalwarpableWhether or not target can be warped.
OptionalzoomZooms in the elements of a moveable.
You can add your custom able.