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]
OptionalonbeforeRender event occurs before the dragging of all events.
OptionalonbeforeRenderEnd event occurs before the end of all events.
OptionalonbeforeRenderGroup event occurs before the dragging of all events in group.
OptionalonbeforeRenderGroupEnd event occurs before the end of all events in group.
OptionalonbeforeRenderGroupStart event occurs before the first start of all events in group.
OptionalonbeforeRenderStart event occurs before the first start of all events.
OptionalonWhen resizing, beforeResize is called before resize occurs. In beforeResize, you can get and set the pre-value before resizing.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, { resizable: true });
moveable.on("beforeResize", ({ setFixedDirection }) => {
if (shiftKey) {
setFixedDirection([0, 0]);
}
});
moveable.on("resize", ({ target, width, height, drag }) => {
target.style.width = `${width}px`;
target.style.height = `${height}px`;
target.style.transform = drag.transform;
});
OptionalonWhen resizing the group, beforeResizeGroup is called before resizeGroup occurs. In beforeResizeGroup, you can get and set the pre-value before resizing.
OptionalonWhen rotating, beforeRotate is called before rotate occurs. In beforeRotate, you can get and set the pre-value before rotating.
OptionalonWhen rotating the group, beforeRotateGroup is called before rotateGroup occurs. In beforeRotateGroup, you can get and set the pre-value before rotating.
OptionalonWhen scaling, beforeScale is called before scale occurs. In beforeScale, you can get and set the pre-value before scaling.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, { scalable: true });
moveable.on("beforeScale", ({ setFixedDirection }) => {
if (shiftKey) {
setFixedDirection([0, 0]);
}
});
moveable.on("scale", ({ target, transform, dist }) => {
target.style.transform = transform;
});
OptionalonWhen scaling the group, beforeScaleGroup is called before scaleGroup occurs. In beforeScaleGroup, you can get and set the pre-value before scaling.
OptionalonWhen the bounds or inner bounds that the target touches while snapping are changed, the bound event is called.
OptionalonWhen the targets of Moveable are changed, the changeTargets event is called.
OptionalonWhen you click on the element, the click event is called.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
target: document.querySelector(".target"),
});
moveable.on("click", ({ hasTarget, containsTarget, targetIndex }) => {
// If you click on an element other than the target and not included in the target, index is -1.
console.log("onClickGroup", target, hasTarget, containsTarget, targetIndex);
});
OptionalonWhen you click on the element inside the group, the clickGroup event is called.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
target: [].slice.call(document.querySelectorAll(".target")),
});
moveable.on("clickGroup", ({ inputTarget, isTarget, containsTarget, targetIndex }) => {
// If you click on an element other than the target and not included in the target, index is -1.
console.log("onClickGroup", inputTarget, isTarget, containsTarget, targetIndex);
});
OptionalonWhen drag the clip area or controls, the clip event is called.
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);
});
OptionalonWhen drag end the clip area or controls, the clipEnd event is called.
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);
});
OptionalonWhen drag start the clip area or controls, the clipStart event is called.
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);
});
OptionalonWhen dragging, the drag event is called.
OptionalonWhen the drag finishes, the dragEnd event is called.
OptionalonWhen the group drag, the dragGroup event is called.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
target: [].slice.call(document.querySelectorAll(".target")),
draggable: true
});
moveable.on("dragGroup", ({ targets, events }) => {
console.log("onDragGroup", targets);
events.forEach(ev => {
// drag event
console.log("onDrag left, top", ev.left, ev.top);
// ev.target!.style.left = `${ev.left}px`;
// ev.target!.style.top = `${ev.top}px`;
console.log("onDrag translate", ev.dist);
ev.target!.style.transform = ev.transform;)
});
});
OptionalonWhen the group drag finishes, the dragGroupEnd event is called.
OptionalonWhen the group drag starts, the dragGroupStart event is called.
OptionalonWhen drag the origin, the dragOrigin event is called.
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);
});
OptionalonWhen drag end the origin, the dragOriginEnd event is called.
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);
});
OptionalonWhen drag start the origin, the dragOriginStart event is called.
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);
});
OptionalonWhen the drag starts, the dragStart event is called.
OptionalonWhen pinching, the pinch event is called with part of scale, rotate, resize
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
rotatable: true,
scalable: true,
pinchable: true, // ["rotatable", "scalable"]
});
moveable.on("pinch", ({ target }) => {
console.log(target);
});
moveable.on("rotate", ({ target }) => {
console.log(target);
});
moveable.on("scale", ({ target }) => {
console.log(target);
});
OptionalonWhen the pinch finishes, the pinchEnd event is called.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
rotatable: true,
scalable: true,
pinchable: true, // ["rotatable", "scalable"]
});
moveable.on("pinchEnd", ({ target }) => {
console.log(target);
});
moveable.on("rotateEnd", ({ target }) => {
console.log(target);
});
moveable.on("scaleEnd", ({ target }) => {
console.log(target);
});
OptionalonWhen the group pinch, the pinchGroup event is called.
OptionalonWhen the group pinch finishes, the pinchGroupEnd event is called.
OptionalonWhen the group pinch starts, the pinchGroupStart event is called.
OptionalonWhen the pinch starts, the pinchStart event is called with part of scaleStart, rotateStart, resizeStart
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
rotatable: true,
scalable: true,
pinchable: true, // ["rotatable", "scalable"]
});
moveable.on("pinchStart", ({ target }) => {
console.log(target);
});
moveable.on("rotateStart", ({ target }) => {
console.log(target);
});
moveable.on("scaleStart", ({ target }) => {
console.log(target);
});
Optionalonrender event occurs before the target is drawn on the screen.
OptionalonrenderEnd event occurs at the end of all events.
OptionalonrenderGroup event occurs before the target is drawn on the screen in group.
OptionalonrenderGroupEnd event occurs at the end of all events in group.
OptionalonrenderGroupStart event occurs at the first start of all events in group.
OptionalonrenderStart event occurs at the first start of all events.
OptionalonWhen resizing, the resize event is called.
OptionalonWhen the resize finishes, the resizeEnd event is called.
OptionalonWhen the group resize, the resizeGroup event is called.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
target: [].slice.call(document.querySelectorAll(".target")),
resizable: true
});
moveable.on("resizeGroup", ({ targets, events }) => {
console.log("onResizeGroup", targets);
events.forEach(ev => {
const offset = [
direction[0] < 0 ? -ev.delta[0] : 0,
direction[1] < 0 ? -ev.delta[1] : 0,
];
// ev.drag is a drag event that occurs when the group resize.
const left = offset[0] + ev.drag.beforeDist[0];
const top = offset[1] + ev.drag.beforeDist[1];
const width = ev.width;
const top = ev.top;
});
});
OptionalonWhen the group resize finishes, the resizeGroupEnd event is called.
OptionalonWhen the group resize starts, the resizeGroupStart event is called.
OptionalonWhen the resize starts, the resizeStart event is called.
OptionalonWhen rotating, the rotate event is called.
OptionalonWhen the rotate finishes, the rotateEnd event is called.
OptionalonWhen the group rotate, the rotateGroup event is called.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
target: [].slice.call(document.querySelectorAll(".target")),
rotatable: true
});
moveable.on("rotateGroup", ({ targets, events }) => {
console.log("onRotateGroup", targets);
events.forEach(ev => {
const target = ev.target;
// ev.drag is a drag event that occurs when the group rotate.
const left = ev.drag.beforeDist[0];
const top = ev.drag.beforeDist[1];
const deg = ev.beforeDist;
});
});
OptionalonWhen the group rotate finishes, the rotateGroupEnd event is called.
OptionalonWhen the group rotate starts, the rotateGroupStart event is called.
OptionalonWhen the rotate starts, the rotateStart event is called.
OptionalonWhen drag or double click the border area or controls, the round event is called.
OptionalonWhen drag end the border area or controls, the roundEnd event is called.
OptionalonWhen drag or double click the border area or controls, the roundGroup event is called.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
targets: [target1, target2, target3],
roundable: true,
});
moveable.on("roundGroupStart", e => {
console.log(e.targets);
}).on("roundGroup", e => {
e.events.forEach(ev => {
ev.target.style.cssText += ev.cssText;
});
}).on("roundGroupEnd", e => {
console.log(e);
});
OptionalonWhen drag end the border area or controls, the roundGroupEnd event is called.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
targets: [target1, target2, target3],
roundable: true,
});
moveable.on("roundGroupStart", e => {
console.log(e.targets);
}).on("roundGroup", e => {
e.events.forEach(ev => {
ev.target.style.cssText += ev.cssText;
});
}).on("roundGroupEnd", e => {
console.log(e);
});
OptionalonWhen drag start the clip area or controls, the roundGroupStart event is called.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
targets: [target1, target2, target3],
roundable: true,
});
moveable.on("roundGroupStart", e => {
console.log(e.targets);
}).on("roundGroup", e => {
e.events.forEach(ev => {
ev.target.style.cssText += ev.cssText;
});
}).on("roundGroupEnd", e => {
console.log(e);
});
OptionalonWhen drag start the clip area or controls, the roundStart event is called.
OptionalonWhen scaling, the scale event is called.
OptionalonWhen the scale finishes, the scaleEnd event is called.
OptionalonWhen the group scale, the scaleGroup event is called.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
target: [].slice.call(document.querySelectorAll(".target")),
scalable: true
});
moveable.on("scaleGroup", ({ targets, events }) => {
console.log("onScaleGroup", targets);
events.forEach(ev => {
const target = ev.target;
// ev.drag is a drag event that occurs when the group scale.
const left = ev.drag.beforeDist[0];
const top = ev.drag.beforeDist[1];
const scaleX = ev.scale[0];
const scaleY = ev.scale[1];
});
});
OptionalonWhen the group scale finishes, the scaleGroupEnd event is called.
OptionalonWhen the group scale starts, the scaleGroupStart event is called.
OptionalonWhen the scale starts, the scaleStart event is called.
OptionalonWhen the drag cursor leaves the scrollContainer, the scroll event occur to scroll.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
target: document.querySelector(".target"),
});
moveable.on("scroll", ({ scrollContainer, direction }) => {
scrollContainer.scrollLeft += direction[0] * 10;
scrollContainer.scrollTop += direction[1] * 10;
});
OptionalonWhen the drag cursor leaves the scrollContainer, the scrollGroup event occur to scroll in group.
import Moveable from "@moveable-next/vanilla";
const moveable = new Moveable(document.body, {
target: [].slice.call(document.querySelectorAll(".target")),
});
moveable.on("scroll", ({ scrollContainer, direction }) => {
scrollContainer.scrollLeft += direction[0] * 10;
scrollContainer.scrollTop += direction[1] * 10;
});
OptionalonWhen you drag or dragControl, the snap event is called.
OptionalonWhen warping, the warp event is called.
import Moveable from "@moveable-next/vanilla";
let matrix = [
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1,
];
const moveable = new Moveable(document.body, { warpable: true });
moveable.on("warp", ({ target, transform, delta, multiply }) => {
// target.style.transform = transform;
matrix = multiply(matrix, delta);
target.style.transform = `matrix3d(${matrix.join(",")})`;
});
OptionalonWhen the warp finishes, the warpEnd event is called.
OptionalonWhen the warp starts, the warpStart event is called.
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.