Moveable
    Preparing search index...

    Interface DefaultOptions

    interface DefaultOptions {
        ables?: Able<IObject<any>, IObject<any>>[];
        checkInput?: boolean;
        className?: string;
        container?: SVGElement | HTMLElement | null;
        controlPadding?: number;
        cspNonce?: string;
        dragContainer?: Window | MoveableRefType<HTMLElement>;
        dragFocusedInput?: boolean;
        dragTarget?: MoveableRefType<SVGElement | HTMLElement>;
        dragTargetSelf?: boolean;
        flushSync?: (callback: () => void) => void;
        hideDefaultLines?: boolean;
        linePadding?: number;
        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;
        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.

    ""
    
    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
    
    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
    
    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;