Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
V

vue3-draggable-resizable

> 前端框架
Open source

[Vue3 组件] 用于拖拽调整位置和大小的的组件,同时支持元素吸附对齐,实时参考线。

758 stars0 likes2 views
WebsiteGitHub

About

[Vue3 组件] 用于拖拽调整位置和大小的的组件,同时支持元素吸附对齐,实时参考线。

Vue3DraggableResizable

[Vue3 组件] 用于拖拽调整位置和大小的的组件,同时支持冲突检测,元素吸附对齐,实时参考线。 [ Vue3 Component ] Draggable and resizable component for vue3, and, support element adsorption alignment, real-time reference line, etc.

点击查看中文文档

Table of Contents

  • Features
  • Usage
    • Props
    • Events
    • Use adsorption alignment

Features

  • Draggable and resizable
  • Define handles for resizing
  • Restrict movement and size in parent node
  • Customize various class names
  • Provide your own markup for handles
  • Adsorption alignment
  • Reference line

Usage

bash
$ npm install vue3-draggable-resizable

Register the Vue3DraggableResizable

javascript
// >main.js
import { createApp } from 'vue'
import App from './App.vue'
import Vue3DraggableResizable from 'vue3-draggable-resizable'
//default styles
import 'vue3-draggable-resizable/dist/Vue3DraggableResizable.css'

// You will have a global component named "Vue3DraggableResizable"
createApp(App)
  .use(Vue3DraggableResizable)
  .mount('#app')

You can also use it separately within the component

javascript
// >component.js
import { defineComponent } from 'vue'
import Vue3DraggableResizable from 'vue3-draggable-resizable'
//default styles
import 'vue3-draggable-resizable/dist/Vue3DraggableResizable.css'

export default defineComponent({
  components: { Vue3DraggableResizable }
  // ...other
})

Here is a complete example of using "vue-template"

xml

  

  

Props

initW

type: Number

default: null

Set initial width(px)

xml

initH

type: Number

default: null

Set initial height(px)

xml

w

type: Number

default: 0

Current width(px) of the container.

You can use "v-model:w" to keeps it up-to-date

xml

h

type: Number

default: 0

Current height(px) of the container.

You can use "v-model:h" to keeps it up-to-date

xml

x

type: Number

default: 0

Current left(px) of the container.

You can use "v-model:x" to keeps it up-to-date

xml

y

type: Number

default: 0

The current top(px) of the container.

You can use "v-model:y" to keeps it up-to-date

xml

minW

type: Number

default: 20

Minimum width(px)

xml

minH

type: Number

default: 20

Minimum height(px)

xml

active

type: Boolean

default: false

Indicates whether the component is selected.

You can use "v-model:active" to keeps it up-to-date

xml

draggable

type: Boolean

default: true

Defines the component can be draggable or not

xml

resizable

type: Boolean

default: true

Defines the component can be resizable or not

xml

lockAspectRatio

type: Boolean

default: false

The lockAspectRatio property is used to lock aspect ratio.

xml

disabledX

type: Boolean

default: false

Defines the component can be moved on x-axis or not

xml

disabledY

type: Boolean

default: false

Defines the component can be moved on y-axis or not

xml

disabledW

type: Boolean

default: false

Defines the component`s width can be modify or not

xml

disabledH

type: Boolean

default: false

Defines the component`s height can be modify or not

xml

parent

type: Boolean

default: false

Restrict movement and size within its parent node

xml

handles

type: Array

default: ['tl', 'tm', 'tr', 'ml', 'mr', 'bl', 'bm', 'br']

Define the array of handles to restrict the element resizing

  • tl : Top left
  • tm : Top middle
  • tr : Top right
  • mr : Middle right
  • ml : Middle left
  • bl : Bottom left
  • bm : Bottom middle
  • br : Bottom right
xml

classNameDraggable

type: String

default: draggable

Used to set the custom class of a draggable-resizable component when draggable is enable.

xml

classNameResizable

type: String

default: resizable

Used to set the custom class of a draggable-resizable component when resizable is enable.

xml

classNameDragging

type: String

default: dragging

Used to set the custom class of a draggable-resizable component when is dragging.

xml

classNameResizing

type: String

default: resizing

Used to set the custom class of a draggable-resizable component when is resizing.

xml

classNameActive

type: String

default: active

Used to set the custom class of a draggable-resizable component when is active.

xml

classNameHandle

type: String

default: handle

Used to set the custom common class of each handle element.

xml

following handle nodes will be rendered

xml
...

...

Events

activated

payload: -

xml

deactivated

payload: -

xml

drag-start

payload: { x: number, y: number }

xml

dragging

payload: { x: number, y: number }

xml

drag-end

payload: { x: number, y: number }

xml

resize-start

payload: { x: number, y: number, w: number, h: number }

xml

resizing

payload: { x: number, y: number, w: number, h: number }v

xml

resize-end

payload: { x: number, y: number, w: number, h: number }

xml

Use-adsorption-alignment

You need to import another component to use the "adsorption alignment" feature.

This can be used as follows.

xml

  

  

DraggableContainer Props

These props apply to DraggableContainer

disabled

type: Boolean

default: false

Disable this feature

xml

  
    Test
  
  
    Another test
  

adsorbParent

type: Boolean

default: true

Adsorption near parent component

xml

  
    Test
  
  
    Another test
  

adsorbCols

type: Array

default: null

Custom guides(column)

xml

  
    Test
  
  
    Another test
  

adsorbRows

type: Array

default: null

Custom guides(row)

xml

  
    Test
  
  
    Another test
  

referenceLineVisible

type: Boolean

default: true

reference line visible

xml

  
    Test
  
  
    Another test
  

referenceLineColor

type: String

default: #f00

reference line color

xml

  
    Test
  
  
    Another test
  

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptcomponentconflict-detectiondragdraggable

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架