Moveable
    Preparing search index...

    Interface MoveableDefaultOptions

    interface MoveableDefaultOptions {
        ables?: Able<IObject<any>, IObject<any>>[];
        checkInput?: boolean;
        className?: string;
        container?: SVGElement | HTMLElement | null;
        controlPadding?: number;
        cspNonce?: string;
        dragArea?: boolean;
        dragContainer?: Window | MoveableRefType<HTMLElement>;
        dragFocusedInput?: boolean;
        dragTarget?: MoveableRefType<SVGElement | HTMLElement>;
        dragTargetSelf?: boolean;
        flushSync?: (callback: () => void) => void;
        hideDefaultLines?: boolean;
        linePadding?: number;
        origin?: boolean;
        padding?: number | PaddingBox;
        passDragArea?: boolean;
        persistData?: PersistRectData | null;
        pinchOutside?: boolean;
        pinchThreshold?: number;
        preventClickDefault?: boolean;
        preventClickEventOnDrag?: boolean;
        preventDefault?: boolean;
        preventRightClick?: boolean;
        preventWheelClick?: boolean;
        props?: Record<string, any>;
        rootContainer?: MoveableRefType<HTMLElement>;
        stopPropagation?: boolean;
        svgOrigin?: string;
        target?: SVGElement | HTMLElement | null;
        transformOrigin?: string | (string | number)[];
        translateZ?: string | number;
        triggerAblesSimultaneously?: boolean;
        useAccuratePosition?: boolean;
        useMutationObserver?: boolean;
        useResizeObserver?: boolean;
        viewContainer?: MoveableRefType<HTMLElement>;
        zoom?: number;
    }

    Hierarchy (View Summary)

    Index
    ables?: Able<IObject<any>, IObject<any>>[]

    You can add your custom able.

    []
    
    checkInput?: boolean

    Checks whether this is an element to input text or contentEditable, and prevents dragging.

    false
    
    className?: string

    You can specify the className of the moveable controlbox.

    ""
    
    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body, {
    className: "",
    });

    moveable.className = "moveable1";
    container?: SVGElement | HTMLElement | null

    A container into which Moveables are inserted. Set it only when used within the slot of Web Components or when the container is different.

    parentElement
    
    controlPadding?: number

    By 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.

    0.44.0

    0
    
    cspNonce?: string

    add nonce property to style for CSP.

    ""
    
    dragArea?: boolean

    Instead 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.

    if group, true, else fals
    
    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body, {
    dragArea: false,
    });
    dragContainer?: Window | MoveableRefType<HTMLElement>

    Container area where drag works

    window
    
    dragFocusedInput?: boolean

    Whether to drag the focused input If checkInput is true, this option is not applied.

    0.47.0

    false
    
    dragTarget?: MoveableRefType<SVGElement | HTMLElement>

    The external target(s) to drag Moveable target(s)

    target
    
    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body);
    moveable.target = document.querySelector(".target");
    moveable.dragTarget = document.querySelector(".dragTarget");
    dragTargetSelf?: boolean

    If dragTarget is set directly, taget itself cannot be dragged. Whether to drag the target as well.

    false
    
    flushSync?: (callback: () => void) => void

    If you are using React 18's concurrent mode, use flushSync for UI sync.

    empty function
    
    import { flushSync } from "react-dom";

    <Moveable flushSync={flushSync} />
    hideDefaultLines?: boolean

    Whether to hide the line corresponding to the rect of the target.

    false
    
    linePadding?: number

    By adding padding to the line, you can increase the area of the line that can be clicked and dragged.

    0.43.0

    0
    
    origin?: boolean

    Whether or not the origin control box will be visible or not.

    true
    
    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body);

    moveable.origin = true;
    padding?: number | PaddingBox

    Add padding around the target to increase the drag area.

    null
    
    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body, {
    target: document.querySelector(".target"),
    padding: { left: 0, top: 0, right: 0, bottom: 0 },
    });
    moveable.padding = { left: 10, top: 10, right: 10, bottom: 10 },
    moveable.updateRect();
    passDragArea?: boolean

    Set pointerEvents: none; css to pass events in dragArea.

    false
    
    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body, {
    dragArea: false,
    });
    persistData?: PersistRectData | null

    Data for first render

    null
    
    pinchOutside?: boolean

    Whether the container containing the target becomes a pinch.

    true
    
    pinchThreshold?: number

    Minimum distance to pinch.

    20
    
    preventClickDefault?: boolean

    Prevent click event on dragStart. (mousedown, touchstart)

    false
    
    preventClickEventOnDrag?: boolean

    Prevent click event on drag. (mousemove, touchmove)

    true
    
    preventDefault?: boolean

    Whether to call preventDefault on touchstart or mousedown

    0.44.0

    true
    
    preventRightClick?: boolean

    Whether to prevent dragging using the right mouse button

    true
    
    preventWheelClick?: boolean

    Whether to prevent dragging using the wheel (middle) mouse button

    true
    
    props?: Record<string, any>

    You can use props in object format or custom props.

    empty object
    
    rootContainer?: MoveableRefType<HTMLElement>

    Moveable Root Container (No Transformed Container)

    parentElement
    
    stopPropagation?: boolean

    Whether to prevent bubbling of events like mousedown, touchstart, etc.

    false
    
    svgOrigin?: string

    Sets the transform origin based on the svg target. If not set, it is set as the transform origin based on the owner of svg.

    0.47.0

    ""
    
    target?: SVGElement | HTMLElement | null

    The target(s) to indicate Moveable Control Box.

    null
    
    transformOrigin?: string | (string | number)[]

    The default transformOrigin of the target can be set in advance.

    ""
    
    translateZ?: string | number

    You can set the translateZ value of moveable.

    50
    
    triggerAblesSimultaneously?: boolean

    Lets generate events of ables at the same time. (like Resizable, Scalable)

    false
    
    useAccuratePosition?: boolean

    Whether 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.

    false
    
    useMutationObserver?: boolean

    Whether the target size, pos in inline style is detected and updated whenever it changes. It is more effective when used together with useResizeObserver.

    false
    
    useResizeObserver?: boolean

    Whether the target size is detected and updated whenever it changes. It is more effective when used together with useMutationObserver.

    false
    
    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body);
    moveable.useResizeObserver = true;
    viewContainer?: MoveableRefType<HTMLElement>

    If you want to set the dragging information to the viewer, refer to the following.

    null
    
    zoom?: number

    Zooms in the elements of a moveable.

    1
    
    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body);
    moveable.zoom = 2;